adhocracy_core.sheets package

Data structures/validation, set/get for an isolated set of resource data.

class BaseResourceSheet(meta: adhocracy_core.interfaces.SheetMetadata, context: <InterfaceClass adhocracy_core.interfaces.IResourceSheet>, registry: pyramid.registry.Registry, request: <InterfaceClass pyramid.interfaces.IRequest>=None, creating: adhocracy_core.interfaces.ResourceMetadata=None)[source]

Bases: object

Sheet object to get/set resource data defined by a term:schema.

Variables:
  • meta (SheetMetadata) – The sheet configuration
  • context (IResource) –

    Resource to set/get data, find services, traverse object hierarchy.

    If creating this should be the parent of the to be created resource.

  • registry – Pyramid registry to get Adapters, sheets, metadata, settings, ...
  • request (pyramid.interfaces.IRequest) –

    The current request or None.

    Use for permission checks, serialize/deserialize Resource-URLs, get user (IResourceSheet.deserialze() and IResourceSheet.serialize() depend request).

  • creating (ResourceMetadata) –

    The configuration of the to be created resource.

    If not None the context attribute should be the parent of the new resource and set/get methods should not be used.

    Used by deferred validators to allow different behavior when creating.

  • schema (colander.MappingSchema) –

    schema to define the data structure (without bindings).

    Deferred schema validators and defaults values are not executed yet. To the the schema with bindings use: IResourceSheet.get_schema_with_bindings().

    Deferred default values can rely on the following bindings:

    context, registry, creating

    Deferred validators can rely on the following bindings:

    context, registry, request, creating
get_schema_with_bindings() → colander.Schema[source]
get(params: dict={}, add_back_references=True, omit_defaults=False) → dict[source]

Return appstruct data.

Read adhocracy_core.interfaces.IResourceSheet.get()

set(appstruct: dict, omit=(), send_event=True, send_reference_event=True, omit_readonly: bool=True, autoupdated=False) → bool[source]

Store appstruct.

Read adhocracy_core.interfaces.IResourceSheet.set()

serialize(params: dict=None, add_back_references: bool=True)[source]

Get sheet appstruct data and serialize.

Read adhocracy_core.interfaces.IResourceSheet.serialize()

deserialize(cstruct: dict) → dict[source]

Deserialize ctruct.

Read adhocracy_core.interfaces.IResourceSheet.serialize()

delete_field_values(fields: [<class 'str'>])[source]

Delete value for every field name in fields.

after_set(changed: bool)[source]

Hook to run after setting data. Not used.

class AnnotationRessourceSheet(meta: adhocracy_core.interfaces.SheetMetadata, context: <InterfaceClass adhocracy_core.interfaces.IResourceSheet>, registry: pyramid.registry.Registry, request: <InterfaceClass pyramid.interfaces.IRequest>=None, creating: adhocracy_core.interfaces.ResourceMetadata=None)[source]

Bases: adhocracy_core.sheets.BaseResourceSheet

Resource Sheet that stores data in dictionary annotation.

delete_field_values(fields: [<class 'str'>])[source]

Delete value for every field name in fields.

class AttributeResourceSheet(meta: adhocracy_core.interfaces.SheetMetadata, context: <InterfaceClass adhocracy_core.interfaces.IResourceSheet>, registry: pyramid.registry.Registry, request: <InterfaceClass pyramid.interfaces.IRequest>=None, creating: adhocracy_core.interfaces.ResourceMetadata=None)[source]

Bases: adhocracy_core.sheets.BaseResourceSheet

Resource Sheet that stores data as context attributes.

delete_field_values(fields: [<class 'str'>])[source]

Delete value for every field name in fields.

add_sheet_to_registry(metadata: adhocracy_core.interfaces.SheetMetadata, registry: pyramid.registry.Registry)[source]

Register sheet adapter and metadata to registry.

There registry should have an content attribute with adhocracy_core.registry.ResourceRegistry to store the metadata.

includeme(config)[source]

Include the sheets in this package.