adhocracy_core.content package¶
Create resources, get sheets/metadata, permission checks.
-
class
ResourceContentRegistry(registry)[source]¶ Bases:
substanced.content.ContentRegistryExtend substanced content registry to work with resources.
Initialize self.
-
resources_meta= None¶ Resources meta mapping.
Dictionary with key iresource (resource type interface) and value
adhocracy_core.interfaces.ResourceMetadata.
-
sheets_meta= None¶ Sheets meta mapping.
Dictionary with key isheet (sheet type interface) and value
adhocracy_core.interfaces.SheetMetadata.
-
workflows_meta= None¶ Dictionary with key workflow name and value data.
The value data structure is defined in
adhocracy_core.workflows.schemas.Workflow
-
workflows= None¶ Dictionary with key workflow name and value
substanced.workflow.IWorkflow.
-
get_resources_meta_addable(context: object, request: pyramid.request.Request) → [<class 'adhocracy_core.interfaces.ResourceMetadata'>][source]¶ Get addable resource meta for context, mind permissions.
-
can_add_resource(request: pyramid.request.Request, meta: adhocracy_core.interfaces.ResourceMetadata, context: <InterfaceClass adhocracy_core.interfaces.IPool>) → bool[source]¶ Check that the resource type in meta is addable to context.
-
resources_meta_addable¶ Addable resources metadata mapping.
Dictionary with key iresource (resource type interface)` and value list of
adhocracy_core.interfaces.ResourceMetadata. The value includes only addables for a context with resource type.
-
permissions¶ Set of all permissions defined in the system.
-
get_sheet(context: object, isheet: <InterfaceClass zope.interface.interfaces.IInterface>, request: pyramid.request.Request=None, creating: adhocracy_core.interfaces.ResourceMetadata=None) → <InterfaceClass adhocracy_core.interfaces.IResourceSheet>[source]¶ Get sheet for context and set the ‘context’ attribute.
Raises: adhocracy_core.exceptions.RuntimeConfigurationError – if there is no isheet sheet registered for context.
-
get_sheet_field(context: object, isheet: <InterfaceClass zope.interface.interfaces.IInterface>, field: str, request: pyramid.request.Request=None) → object[source]¶ Get sheet for context and return the value for field name.
Raises: - adhocracy_core.exceptions.RuntimeConfigurationError – if there is no isheet sheet registered for context.
- KeyError – if field does not exists for sheet isheet.
-
get_sheets_all(context: object, request: pyramid.request.Request=None) → [<InterfaceClass adhocracy_core.interfaces.IResourceSheet>][source]¶ Get all sheets for context.
-
get_sheets_create(context: object, request: pyramid.request.Request=None, iresource: <InterfaceClass zope.interface.interfaces.IInterface>=None) → [<InterfaceClass adhocracy_core.interfaces.IResourceSheet>][source]¶ Get creatable sheets for context or iresource.
Parameters: - request (
Request) – If not None filter by sheet create permission. - iresource – If not None return sheets for this resource type. The creating sheet attribute is set to the resource metadata of this type. The returned sheets should only be used to deserialize data to create a new resource.
- request (
-
get_sheets_edit(context: object, request: pyramid.request.Request=None) → [<InterfaceClass adhocracy_core.interfaces.IResourceSheet>][source]¶ Get editable sheets for context.
Parameters: request ( Request) – If not None filter by sheet edit permission.
-
get_sheets_read(context: object, request: pyramid.request.Request=None) → [<InterfaceClass adhocracy_core.interfaces.IResourceSheet>][source]¶ Get readable sheets for context.
Parameters: request ( Request) – If not None filter by sheet edit permission.
-
resolve_isheet_field_from_dotted_string(dotted: str) → tuple[source]¶ Resolve dotted string to isheet and field name and schema node.
Dotted: isheet.__identifier__ and field_name separated by ‘:’ Returns: tuple with isheet (ISheet), field_name (str), field schema node (colander.SchemaNode). Raises: ValueError – If the string is not dotted or it cannot be resolved to isheet and field name.
-
get_workflow(context: object) → <InterfaceClass substanced.interfaces.IWorkflow>[source]¶ Get workflow of context or None.
-
can_add_anonymized(context: object, request: pyramid.request.Request) → bool[source]¶ Check if children can be created/added anonymized to context.
-
can_edit_anonymized(context: object, request: pyramid.request.Request) → bool[source]¶ Check if context may be edited anonymously.
-