API Documentation

This page contains some basic documentation for the Online Linguistic Database project.

The onlinelinguisticdatabase Module

Contains all the controllers, model and templates as sub-modules.

The controllers Module

Contains all the controllers. The three most important of which are FormController, FileController and CollectionController.

The form Module

class onlinelinguisticdatabase.controllers.form.DateRestrictorStruct(*args, **kw)

Messages

badDictType:
The input must be dict-like (not a %(type)s: %(value)r)
badType:
The input must be a string (not a %(type)s: %(value)r)
empty:
Please enter a value
missingValue:
Missing value
noneType:
The input must be a string (not None)
notExpected:
The input field %(name)s was not expected.
class onlinelinguisticdatabase.controllers.form.FirsGlossNotEmpty(*args, **kw)

Custom validator. Ensures that the first gloss field, ‘gloss-0.text’, has some content.

Messages

badType:
The input must be a string (not a %(type)s: %(value)r)
empty:
Please enter a value
noneType:
The input must be a string (not None)
one_gloss:
Please enter a gloss in the first gloss field
class onlinelinguisticdatabase.controllers.form.FormController

Form Controller contains actions about OLD Forms. Authorization and authentication are implemented by the helper decorators authenticate and authorize which can be found in lib/auth.py.

add()
Display HTML form for adding a new BLD Form. HTML form calls create action.
associate(id=None)
Associate BLD Form with id=id to a BLD File.
create()
Enter BLD Form data into the database. This is the action referenced by the html form rendered by the add action.
delete(id)
Delete the BLD form with ID=id.
export(id=None)

Export a set of one or more BLD Forms.

If id is None, export all Forms from last search (using session[‘formSearchValues’]); if id is ‘memory’, export Forms in Memory; otherwise, export Form with id == id.

This action renders an html form (templates/base/export) where the user chooses an export type.

exporter(id=None)

Produce an export document based on the export type chosen by the user in the form rendered by the export action.

An empty id indicates that the set of forms to be exported should be queried from the database based on the values of session[‘formSearchValues’].

An id of ‘memory’ indicates that we should export everything in Memory.

To add new export types, add a def to ‘/base/exporter.html’ and add your def name and description to app_globals.exportOptions.

history(id=None)
Display previous versions (i.e., history) of BLD Form with id=id.
previoussearches()
Display this user’s last 10 searches so that any can be repeated and/or altered.
query()
Query action validates the search input values; if valid, query stores the search input values in the session and redirects to results; if invalid, query redirect to search action (though I don’t think it’s possible to enter an invalid query...). Query is the action referenced by the html form rendered by the search action.
remember(id=None)
Put BLD Form with id=id into memory.
results()
Results action uses the filterSearchQuery helper function to build a query based on the values entered by the user in the search form.
save()
Updates existing BLD Form. This is the action referenced by the html form rendered by the update action.
search(values=None, errors=None)
Display HTML form for searching for BLD Forms. HTML form calls query action.
searchprevious(id)
Here id represents the index of the search to be repeated from the list of previous searches stored in session[‘previousSearches’]. If the id/index does not correspond to a stored search, the system simply redirects to the (blank) search action.
update(id=None)
Displays an HTML form for updating a BLD Form. HTML form calls save action.
view(id)
View a BLD Form. Requires a Form ID as input.
class onlinelinguisticdatabase.controllers.form.Keyword(*args, **kw)

Keyword validator ensures that keywords are unicode strings.

Messages

badDictType:
The input must be dict-like (not a %(type)s: %(value)r)
badType:
The input must be a string (not a %(type)s: %(value)r)
empty:
Please enter a value
missingValue:
Missing value
noneType:
The input must be a string (not None)
notExpected:
The input field %(name)s was not expected.
class onlinelinguisticdatabase.controllers.form.NewFormForm(*args, **kw)

NewFormForm is a Schema for validating the data entered at the Add Form page.

Messages

badDictType:
The input must be dict-like (not a %(type)s: %(value)r)
badType:
The input must be a string (not a %(type)s: %(value)r)
empty:
Please enter a value
missingValue:
Missing value
noneType:
The input must be a string (not None)
notExpected:
The input field %(name)s was not expected.
class onlinelinguisticdatabase.controllers.form.RestrictorStruct(*args, **kw)

Messages

badDictType:
The input must be dict-like (not a %(type)s: %(value)r)
badType:
The input must be a string (not a %(type)s: %(value)r)
empty:
Please enter a value
missingValue:
Missing value
noneType:
The input must be a string (not None)
notExpected:
The input field %(name)s was not expected.
class onlinelinguisticdatabase.controllers.form.SearchFormForm(*args, **kw)

SearchForm is a Schema for validating the search terms entered at the Search Forms page.

Messages

badDictType:
The input must be dict-like (not a %(type)s: %(value)r)
badType:
The input must be a string (not a %(type)s: %(value)r)
empty:
Please enter a value
missingValue:
Missing value
noneType:
The input must be a string (not None)
notExpected:
The input field %(name)s was not expected.
class onlinelinguisticdatabase.controllers.form.UpdateFormForm(*args, **kw)

Messages

badDictType:
The input must be dict-like (not a %(type)s: %(value)r)
badType:
The input must be a string (not a %(type)s: %(value)r)
empty:
Please enter a value
missingValue:
Missing value
noneType:
The input must be a string (not None)
notExpected:
The input field %(name)s was not expected.
onlinelinguisticdatabase.controllers.form.getFormAttributes(form, result)
Given a Form object and a result dictionary populated by user-entered data, this action populates the appropriate attributes with the appropriate values. Function called by both create() and save() actions.
onlinelinguisticdatabase.controllers.form.rememberPreviousSearches(searchToRemember)
Function stores the last 10 searches in the session. These searches are stored as a list of dictionaries; the same dictionaries outputed by the query action.
onlinelinguisticdatabase.controllers.form.renderAddForm(values=None, errors=None, addUpdate='add')
Function is called by both the add and update actions to create the Add Form and Update Form html forms. The create and save actions can also call this function if any errors are present in the input.

The helpers Module

Helper functions

Consists of functions to typically be used within templates, but also available to Controllers. This module is available to templates as ‘h’.

The queryBuilder Module

Query Builder

Functions used to add filters to an SQLAlchemy query based on the search options set by a user.