endi.events package

Submodules

endi.events.business module

class endi.events.business.BpfDataModified(request, business_id)

Bases : object

endi.events.business.includeme(config)
endi.events.business.on_bpf_data_changed(event)

endi.events.expense module

endi.events.files module

class endi.events.files.FileAdded(request, file_object, current_form_data=None)

Bases : object

Event to be fired on new file download

>>> request.registry.notify(
...     FileAdded(request, file_object, current_form_data)
... )
action = 'add'
class endi.events.files.FileDeleted(request, file_object, current_form_data=None)

Bases : FileAdded

Event fired when a file was deleted >>> request.registry.notify(FileDeleted(request, file_object))

action = 'delete'
class endi.events.files.FileUpdated(request, file_object, current_form_data=None)

Bases : FileAdded

Event to be fired on file update

>>> request.registry.notify(FileUpdated(request, file_object))
action = 'update'
endi.events.files.includeme(config)
endi.events.files.on_file_change(event)

endi.events.indicators module

class endi.events.indicators.IndicatorChanged(request, indicator)

Bases : object

Fired when an indicator is forced or if it has a status and the status was set

endi.events.indicators.includeme(config)
endi.events.indicators.on_indicator_change(event)

endi.events.mail module

endi.events.model_events module

class endi.events.model_events.BeforeModelCommit(request, changes)

Bases : object

BeforeModelCommit event is fired in the sqlalchemy before_commit event and contains all model changes recorded during the current transaction

Paramètres:
  • request (obj) – The pyramid request currently running

  • changes (list) – list of 2-uples (operation, model) where operation is

one of insert/update/deleted

get_changes_by_class(model_classes)

Build a dict grouping a subset of the changes containing only objects that are instances of one of the model_classes operation are stored by class

>>>  models = event.get_instances_by_class([Invoice, Estimation, CancelInvoice])
>>>  for obj in models[Invoice]:
...      # do your stuff
Paramètres:

model_classes (list) – list of model classes passed to the

isinstance tool :returns: A dict in the form {ModelClass: [(operation, model_instance), …], …}

get_deleted()

Returns the list of models that have been deleted

get_inserts()

Returns the list of models that have been inserted

get_updates()

Returns the list of models that have been updated

class endi.events.model_events.ModelChangeEventManager

Bases : object

static after_commit(session)
static after_rollback(session)
static before_commit(session)
static record_ops(session, flush_context=None, instances=None)
classmethod register(session)
classmethod unregister(session)
endi.events.model_events.includeme(config)

endi.events.status_changed module

endi.events.supplier module

endi.events.tasks module

Handle task (invoice/estimation) related events

Alert the related business on Invoice status change

Paramètres:

event – A StatusChangedEvent instance with an Invoice attached

Module contents