adhocracy_core.events package

Hooks to modify runtime behavior (use ‘subscriber.py’ in you package).

In addition we have the normal substanced events: https://substanced.readthedocs.org/en/latest/api.html#module-substanced.event

class ResourceCreatedAndAdded(object, parent, registry, creator, autoupdated)[source]

Bases: object

An event type sent when a new IResource is created and added.

Parameters:
  • object(adhocracy_core.interfaces.IResource)
  • parent(adhocracy_core.interfaces.IResource)
  • registry(pyramid.registry.Registry)
  • creator(adhocracy_core.resource.principal.IUser)
Param:

autoupdated(bool): The creation was caused by the application, for example service resources or automatic updates of referencing resources.

Initialize self.

class ResourceWillBeDeleted(object, parent, registry)[source]

Bases: object

An event type sent when a IResource will be deleted.

Parameters:
  • object(adhocracy_core.interfaces.IResource)
  • parent(adhocracy_core.interfaces.IResource)
  • registry(pyramid.registry.Registry)

Initialize self.

class ResourceSheetModified(object, isheet, registry, old_appstruct, new_appstruct, request: pyramid.request.Request, autoupdated: bool)[source]

Bases: object

An event type sent when a resource sheet is modified.

Parameters:
  • object – adhocracy_core.interfaces.IResource
  • isheet – adhocracy_core.interfaces.IISheet
  • registry – pyramid.registry.Registry
  • old_appstruct – The old appstruct data (dict)
  • new_appstruct – The new appstruct data (dict)
  • request – The current request or None
Param:

autoupdated(bool): The modification was caused by a modified referenced resource.

Initialize self.

class ItemVersionNewVersionAdded(object, new_version, registry, creator, autoupdated)[source]

Bases: object

An event sent when a new IItemVersion is being added.

Parameters:
  • object(adhocracy_core.interfaces.IItem)
  • new_version(adhocracy_core.interfaces.IItemVersion)
  • registry(pyramid.registry.Registry)
  • creator(adhocracy_core.resource.principal.IUser'
Param:

autoupdated(bool): The modification was caused by a modified referenced resource.

Initialize self.

class SheetReferenceNewVersion(object, isheet, isheet_field, old_version, new_version, registry, creator, root_versions=[], is_batchmode=False)[source]

Bases: object

An event type sent when a referenced ItemVersion has a new follower.

Parameters:
  • object(adhocracy_core.interfaces.IResource)
  • isheet(adhocracy_core.interfaces.IISheet)
  • isheet_field(str) – field name with updated reference
  • old_version(adhocracy_core.interfaces.IItemVersion) – old referenced resource
  • new_version(adhocracy_core.interfaces.IItemVersion) – new referenced resource
  • registry(pyramid.registry.Registry)
  • root_versions(list) – IItemVersions not in the subtree of these root resources should ignore this event. Optional.
  • creator(adhocracy_core.resource.principal.IUser'
  • is_batchmode(bool) – Flag to do sheet autoupdates in batch request mode. Defaults to False.

Initialize self.

class SheetBackReferenceRemoved(object, isheet, reference, registry)[source]

Bases: object

An event type sent when a back reference is removed.

Initialize self.

object = None

adhocracy_core.interfaces.IResource

isheet = None

adhocracy_core.interfaces.ISheet

reference = None

adhocracy_core.graph.Reference that was targeting object.

registry = None

pyramid.content.Registry

class SheetBackReferenceAdded(object, isheet, reference, registry)[source]

Bases: object

An event type sent when a back reference is added.

Initialize self.

object = None

adhocracy_core.interfaces.IResource

isheet = None

adhocracy_core.interfaces.ISheet

reference = None

adhocracy_core.graph.Reference that is targeting object.

registry = None

pyramid.content.Registry

class LocalRolesModified(object, new_local_roles: dict, old_local_roles: dict, registry: pyramid.registry.Registry)[source]

Bases: object

An event type send when an resource`s local role is modified.

Initialize self.

class ActivitiesGenerated(activities: [<class 'adhocracy_core.interfaces.Activity'>], request: pyramid.request.Request)[source]

Bases: object

An event type send when activity s are created.

activities = None

List of added activities.

request = None

Pyramid reqeuest.

includeme(config)[source]

Register event subscriber predicates ‘isheet’ and ‘interface’.