lemur Package

lemur Package

constants Module

class lemur.constants.CRLReason(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntEnum

aACompromise = 10
affiliationChanged = 3
cACompromise = 2
certificateHold = 6
cessationOfOperation = 5
keyCompromise = 1
privilegeWithdrawn = 9
removeFromCRL = 8
superseded = 4
unspecified = 0

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 from a 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.get_count(q)

Count the number of rows in a table. More efficient than count(*) :param q: :return:

lemur.database.get_model_column(model, field)
lemur.database.rollback()

Helper to rollback the current session.

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. Note that paging is not safe unless combined with sorting.

Parameters:
  • query – search query

  • model – model to use for resulting items

  • args – arguments to query with, including sorting and paging parameters

Returns:

the items given the count and page specified

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:

exceptions Module

exception lemur.exceptions.AttrNotFound(field)

Bases: LemurException

exception lemur.exceptions.DuplicateError(key)

Bases: LemurException

exception lemur.exceptions.InvalidAuthority

Bases: Exception

exception lemur.exceptions.InvalidConfiguration

Bases: Exception

exception lemur.exceptions.InvalidDistribution(field)

Bases: LemurException

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

Bases: LemurException

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

Bases: Exception

exception lemur.exceptions.TokenExchangeFailed(error, description)

Bases: LemurException

exception lemur.exceptions.UnknownProvider

Bases: Exception

extensions Module

class lemur.extensions.SQLAlchemy(app=None, use_native_unicode=True, session_options=None, metadata=None, query_class=<class 'flask_sqlalchemy.BaseQuery'>, model_class=<class 'flask_sqlalchemy.model.Model'>, engine_options=None)

Bases: SQLAlchemy

apply_pool_defaults(app, options)

Set default engine options. We enable pool_pre_ping to be the default value.

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_database(app)
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

lemur.manage.create_all()
lemur.manage.generate_settings()

This command is run when default_path doesn’t exist, or init is run and returns a string representing the default data to put into their settings file.

lemur.manage.main()

models Module

Subpackages