lemur Package

lemur Package

constants Module

database Module

lemur.database.add(model)

Helper to add a model to the current session.

Parameters:model
Returns:
lemur.database.clone(model)

Clones the given model and removes it’s primary key :param model: :return:

lemur.database.commit()

Helper to commit the current session.

lemur.database.create(model)

Helper that attempts to create a new instance of an object.

Parameters:model
Returns:
raise IntegrityError:
 
lemur.database.create_query(model, kwargs)

Returns a SQLAlchemy query object for specified model. Model filtered by the kwargs passed.

Parameters:
  • model
  • kwargs
Returns:

lemur.database.delete(model)

Helper that attempts to delete a model.

Parameters:model
lemur.database.filter(query, model, terms)

Helper that searched for ‘like’ strings in column values.

Parameters:
  • query
  • model
  • terms
Returns:

lemur.database.filter_none(kwargs)

Remove all None values froma given dict. SQLAlchemy does not like to have values that are None passed to it.

Parameters:kwargs – Dict to filter
Returns:Dict without any ‘None’ values
lemur.database.find_all(query, model, kwargs)

Returns a query object that ensures that all kwargs are present.

Parameters:
  • query
  • model
  • kwargs
Returns:

lemur.database.find_any(query, model, kwargs)

Returns a query object that allows any kwarg to be present.

Parameters:
  • query
  • model
  • kwargs
Returns:

lemur.database.get(model, value, field='id')

Returns one object filtered by the field and value.

Parameters:
  • model
  • value
  • field
Returns:

lemur.database.get_all(model, value, field='id')

Returns query object with the fields and value filtered.

Parameters:
  • model
  • value
  • field
Returns:

lemur.database.paginate(query, page, count)

Returns the items given the count and page specified

Parameters:
  • query
  • page
  • count
lemur.database.session_query(model)

Returns a SQLAlchemy query object for the specified model.

If model has a query attribute already, that object will be returned. Otherwise a query will be created and returned based on session.

Parameters:model – sqlalchemy model
Returns:query object for model
lemur.database.sort(query, model, field, direction)

Returns objects of the specified model in the field and direction given

Parameters:
  • query
  • model
  • field
  • direction
lemur.database.sort_and_page(query, model, args)

Helper that allows us to combine sorting and paging

Parameters:
  • query
  • model
  • args
Returns:

lemur.database.update(model)

Helper that attempts to update a model.

Parameters:model
Returns:
lemur.database.update_list(model, model_attr, item_model, items)

Helper that correctly updates a models items depending on what has changed

Parameters:
  • model_attr
  • item_model
  • items
  • model
Returns:

decorators Module

lemur.decorators.crossdomain(origin=None, methods=None, headers=None, max_age=21600, attach_to_all=True, automatic_options=True)

exceptions Module

exception lemur.exceptions.AttrNotFound(field)

Bases: lemur.exceptions.LemurException

exception lemur.exceptions.DuplicateError(key)

Bases: lemur.exceptions.LemurException

exception lemur.exceptions.InvalidConfiguration

Bases: exceptions.Exception

exception lemur.exceptions.InvalidListener(*args, **kwargs)

Bases: lemur.exceptions.LemurException

exception lemur.exceptions.LemurException(*args, **kwargs)

Bases: exceptions.Exception

extensions Module

factory Module

lemur.factory.configure_app(app, config=None)

Different ways of configuration

Parameters:
  • app
  • config
Returns:

lemur.factory.configure_blueprints(app, blueprints)

We prefix our APIs with their given version so that we can support multiple concurrent API versions.

Parameters:
  • app
  • blueprints
lemur.factory.configure_extensions(app)

Attaches and configures any needed flask extensions to our app.

Parameters:app
lemur.factory.configure_logging(app)

Sets up application wide logging.

Parameters:app
lemur.factory.create_app(app_name=None, blueprints=None, config=None)

Lemur application factory

Parameters:
  • config
  • app_name
  • blueprints
Returns:

lemur.factory.from_file(file_path, silent=False)

Updates the values in the config from a Python file. This function behaves as if the file was imported as module with the

Parameters:
  • file_path
  • silent
lemur.factory.install_plugins(app)

Installs new issuers that are not currently bundled with Lemur.

Parameters:app
Returns:

manage Module

models Module