org.directives
Attributes
Classes
A configuration action. |
|
A composite configuration action. |
|
Register a cronjob. |
|
Register an export. |
|
Registers a user link group. |
|
Registers a directory search widget. |
|
Registers a text search widget. |
|
Registers a boardlet on the Dashboard. |
Module Contents
- class org.directives.SettingViewMetaAction(model: type, name: str, form: FormFactory, setting: str | None, icon: str | None, order: int, category: str | None)[source]
Bases:
dectate.ActionA configuration action.
Base class of configuration actions.
A configuration action is performed for an object (typically a function or a class object) and affects one or more configuration objects.
Actions can conflict with each other based on their identifier and discriminators. Actions can override each other based on their identifier. Actions can only be in conflict with actions of the same action class or actions with the same
action_group.- config[source]
Describe configuration.
A dict mapping configuration names to factory functions. The resulting configuration objects are passed into
Action.identifier(),Action.discriminators(),Action.perform(), andAction.before()andAction.after().After commit completes, the configured objects are found as attributes on
App.config.
- identifier(setting_view_registry: SettingViewRegistry) tuple[type, str][source]
Returns an immutable that uniquely identifies this config.
Needs to be implemented by the
Actionsubclass.Used for overrides and conflict detection.
If two actions in the same group have the same identifier in the same configurable, those two actions are in conflict and a
ConflictErroris raised duringcommit().If an action in an extending configurable has the same identifier as the configurable being extended, that action overrides the original one in the extending configurable.
- Parameters:
**kw – a dictionary of configuration objects as specified by the
configclass attribute.- Returns:
an immutable value uniquely identifying this action.
- perform(obj: collections.abc.Callable[..., Any], setting_view_registry: SettingViewRegistry) None[source]
Do whatever configuration is needed for
obj.Needs to be implemented by the
Actionsubclass.Raise a
DirectiveErrorto indicate that the action cannot be performed due to incorrect configuration.- Parameters:
obj – the object that the action should be performed for. Typically a function or a class object.
**kw – a dictionary of configuration objects as specified by the
configclass attribute.
- class org.directives.SettingViewAction(model: type, name: str, form: FormFactory, setting: str | None = None, icon: str | None = None, order: int = 0, category: str | None = None, listed: bool = True, render: collections.abc.Callable[..., webob.Response] | str | None = None, template: _typeshed.StrOrBytesPath | None = None, load: collections.abc.Callable[..., Any] | str | None = None, permission: object | str | None = None, internal: bool = False, pass_model: bool = False, **predicates: Any)[source]
Bases:
dectate.CompositeA composite configuration action.
Base class of composite actions.
Composite actions are very simple: implement the
actionmethod and return a iterable of actions in there.- query_classes[source]
A list of actual action classes that this composite can generate.
This is to allow the querying of composites. If the list if empty (the default) the query system refuses to query the composite. Note that if actions of the same action class can also be generated in another way they are in the same query result.
- actions(obj: collections.abc.Callable[..., Any]) collections.abc.Iterator[tuple[dectate.Action, collections.abc.Callable[..., Any]]][source]
Specify a iterable of actions to perform for
obj.The iteratable should yield
action, objtuples, whereactionis an instance of classActionorCompositeandobjis the object to perform the action with.Needs to be implemented by the
Compositesubclass.- Parameters:
obj – the obj that the composite action was performed on.
- Returns:
iterable of
action, objtuples.
- class org.directives.HomepageWidgetAction(tag: str)[source]
Bases:
dectate.ActionRegister a cronjob.
- config[source]
Describe configuration.
A dict mapping configuration names to factory functions. The resulting configuration objects are passed into
Action.identifier(),Action.discriminators(),Action.perform(), andAction.before()andAction.after().After commit completes, the configured objects are found as attributes on
App.config.
- identifier(homepage_widget_registry: dict[str, RegisteredHomepageWidget]) str[source]
Returns an immutable that uniquely identifies this config.
Needs to be implemented by the
Actionsubclass.Used for overrides and conflict detection.
If two actions in the same group have the same identifier in the same configurable, those two actions are in conflict and a
ConflictErroris raised duringcommit().If an action in an extending configurable has the same identifier as the configurable being extended, that action overrides the original one in the extending configurable.
- Parameters:
**kw – a dictionary of configuration objects as specified by the
configclass attribute.- Returns:
an immutable value uniquely identifying this action.
- perform(func: collections.abc.Callable[[], HomepageWidget], homepage_widget_registry: dict[str, RegisteredHomepageWidget]) None[source]
Do whatever configuration is needed for
obj.Needs to be implemented by the
Actionsubclass.Raise a
DirectiveErrorto indicate that the action cannot be performed due to incorrect configuration.- Parameters:
obj – the object that the action should be performed for. Typically a function or a class object.
**kw – a dictionary of configuration objects as specified by the
configclass attribute.
- class org.directives.ExportAction(id: str, **kwargs: Any)[source]
Bases:
dectate.ActionRegister an export.
- config[source]
Describe configuration.
A dict mapping configuration names to factory functions. The resulting configuration objects are passed into
Action.identifier(),Action.discriminators(),Action.perform(), andAction.before()andAction.after().After commit completes, the configured objects are found as attributes on
App.config.
- identifier(export_registry: dict[str, Any]) str[source]
Returns an immutable that uniquely identifies this config.
Needs to be implemented by the
Actionsubclass.Used for overrides and conflict detection.
If two actions in the same group have the same identifier in the same configurable, those two actions are in conflict and a
ConflictErroris raised duringcommit().If an action in an extending configurable has the same identifier as the configurable being extended, that action overrides the original one in the extending configurable.
- Parameters:
**kw – a dictionary of configuration objects as specified by the
configclass attribute.- Returns:
an immutable value uniquely identifying this action.
- perform(cls: collections.abc.Callable[..., Any], export_registry: dict[str, Any]) None[source]
Do whatever configuration is needed for
obj.Needs to be implemented by the
Actionsubclass.Raise a
DirectiveErrorto indicate that the action cannot be performed due to incorrect configuration.- Parameters:
obj – the object that the action should be performed for. Typically a function or a class object.
**kw – a dictionary of configuration objects as specified by the
configclass attribute.
- class org.directives.UserlinkAction[source]
Bases:
dectate.ActionRegisters a user link group.
- config[source]
Describe configuration.
A dict mapping configuration names to factory functions. The resulting configuration objects are passed into
Action.identifier(),Action.discriminators(),Action.perform(), andAction.before()andAction.after().After commit completes, the configured objects are found as attributes on
App.config.
- identifier(linkgroup_registry: list[LinkGroupFactory]) int[source]
Returns an immutable that uniquely identifies this config.
Needs to be implemented by the
Actionsubclass.Used for overrides and conflict detection.
If two actions in the same group have the same identifier in the same configurable, those two actions are in conflict and a
ConflictErroris raised duringcommit().If an action in an extending configurable has the same identifier as the configurable being extended, that action overrides the original one in the extending configurable.
- Parameters:
**kw – a dictionary of configuration objects as specified by the
configclass attribute.- Returns:
an immutable value uniquely identifying this action.
- perform(func: LinkGroupFactory, linkgroup_registry: list[LinkGroupFactory]) None[source]
Do whatever configuration is needed for
obj.Needs to be implemented by the
Actionsubclass.Raise a
DirectiveErrorto indicate that the action cannot be performed due to incorrect configuration.- Parameters:
obj – the object that the action should be performed for. Typically a function or a class object.
**kw – a dictionary of configuration objects as specified by the
configclass attribute.
- class org.directives.DirectorySearchWidgetAction(name: str)[source]
Bases:
dectate.ActionRegisters a directory search widget.
- config[source]
Describe configuration.
A dict mapping configuration names to factory functions. The resulting configuration objects are passed into
Action.identifier(),Action.discriminators(),Action.perform(), andAction.before()andAction.after().After commit completes, the configured objects are found as attributes on
App.config.
- identifier(directory_search_widget_registry: DirectorySearchWidgetRegistry) str[source]
Returns an immutable that uniquely identifies this config.
Needs to be implemented by the
Actionsubclass.Used for overrides and conflict detection.
If two actions in the same group have the same identifier in the same configurable, those two actions are in conflict and a
ConflictErroris raised duringcommit().If an action in an extending configurable has the same identifier as the configurable being extended, that action overrides the original one in the extending configurable.
- Parameters:
**kw – a dictionary of configuration objects as specified by the
configclass attribute.- Returns:
an immutable value uniquely identifying this action.
- perform(cls: type[DirectorySearchWidget[Any]], directory_search_widget_registry: DirectorySearchWidgetRegistry) None[source]
Do whatever configuration is needed for
obj.Needs to be implemented by the
Actionsubclass.Raise a
DirectiveErrorto indicate that the action cannot be performed due to incorrect configuration.- Parameters:
obj – the object that the action should be performed for. Typically a function or a class object.
**kw – a dictionary of configuration objects as specified by the
configclass attribute.
- class org.directives.EventSearchWidgetAction(name: str)[source]
Bases:
dectate.ActionRegisters a text search widget.
- config[source]
Describe configuration.
A dict mapping configuration names to factory functions. The resulting configuration objects are passed into
Action.identifier(),Action.discriminators(),Action.perform(), andAction.before()andAction.after().After commit completes, the configured objects are found as attributes on
App.config.
- identifier(event_search_widget_registry: EventSearchWidgetRegistry) str[source]
Returns an immutable that uniquely identifies this config.
Needs to be implemented by the
Actionsubclass.Used for overrides and conflict detection.
If two actions in the same group have the same identifier in the same configurable, those two actions are in conflict and a
ConflictErroris raised duringcommit().If an action in an extending configurable has the same identifier as the configurable being extended, that action overrides the original one in the extending configurable.
- Parameters:
**kw – a dictionary of configuration objects as specified by the
configclass attribute.- Returns:
an immutable value uniquely identifying this action.
- perform(cls: type[EventSearchWidget], event_search_widget_registry: EventSearchWidgetRegistry) None[source]
Do whatever configuration is needed for
obj.Needs to be implemented by the
Actionsubclass.Raise a
DirectiveErrorto indicate that the action cannot be performed due to incorrect configuration.- Parameters:
obj – the object that the action should be performed for. Typically a function or a class object.
**kw – a dictionary of configuration objects as specified by the
configclass attribute.
- class org.directives.Boardlet(name: str, order: tuple[int, int], icon: str = '', kind: Literal['user', 'citizen'] = 'user')[source]
Bases:
dectate.ActionRegisters a boardlet on the Dashboard.
- config[source]
Describe configuration.
A dict mapping configuration names to factory functions. The resulting configuration objects are passed into
Action.identifier(),Action.discriminators(),Action.perform(), andAction.before()andAction.after().After commit completes, the configured objects are found as attributes on
App.config.
- identifier(boardlets_registry: dict[BoardletKind, dict[str, BoardletConfig]]) str[source]
Returns an immutable that uniquely identifies this config.
Needs to be implemented by the
Actionsubclass.Used for overrides and conflict detection.
If two actions in the same group have the same identifier in the same configurable, those two actions are in conflict and a
ConflictErroris raised duringcommit().If an action in an extending configurable has the same identifier as the configurable being extended, that action overrides the original one in the extending configurable.
- Parameters:
**kw – a dictionary of configuration objects as specified by the
configclass attribute.- Returns:
an immutable value uniquely identifying this action.
- perform(func: type[onegov.org.models.Boardlet], boardlets_registry: dict[BoardletKind, dict[str, BoardletConfig]]) None[source]
Do whatever configuration is needed for
obj.Needs to be implemented by the
Actionsubclass.Raise a
DirectiveErrorto indicate that the action cannot be performed due to incorrect configuration.- Parameters:
obj – the object that the action should be performed for. Typically a function or a class object.
**kw – a dictionary of configuration objects as specified by the
configclass attribute.