class VersionableSchema(colander.MappingSchema): """ Versionable sheet data structure. Set/get predecessor (`follows`) and get successor (`followed_by`) versions of this resource. """ follows = UniqueReferences(reftype=VersionableFollowsReference, validator=deferred_validate_follows) followed_by = UniqueReferences(readonly=True, backref=True, reftype=VersionableFollowsReference)
class TagsSchema(colander.MappingSchema): """Tags sheet data structure. `elements`: Tags in this Pool """ elements = UniqueReferences(reftype=TagsElementsReference)
class TagSchema(colander.MappingSchema): """Tag sheet data structure. `elements`: Resources with this Tag """ elements = UniqueReferences(reftype=TagElementsReference)
class DocumentSchema(MappingSchema): """Document sheet data structure. `elements`: structural subelements like sections """ elements = UniqueReferences(reftype=DocumentElementsReference)
class VersionsSchema(MappingSchema): """Versions sheet data structure. `elements`: Dag for collecting all versions of one item. """ elements = UniqueReferences(reftype=IVersionsElementsReference)
class BadgeSchema(colander.MappingSchema): """Badge sheet data structure.""" groups = UniqueReferences(reftype=BadgeGroupReference, readonly=True, default=deferred_groups_default, )
class GroupSchema(colander.MappingSchema): """Group sheet data structure.""" users = UniqueReferences(readonly=True, backref=True, reftype=PermissionsGroupsReference) roles = Roles()
class VersionableSchema(MappingSchema): """Versionable sheet data structure. Set/get predecessor (`follows`) versions of this resource. """ follows = UniqueReferences(reftype=VersionableFollowsReference, validator=deferred_validate_follows)
class PermissionsSchema(MappingSchema): """Permissions sheet data structure. `groups`: groups this user joined """ roles = Roles() groups = UniqueReferences(reftype=PermissionsGroupsReference, choices_getter=get_group_choices)
class AssetMetadataSchema(MappingSchema): """Data structure storing asset metadata.""" mime_type = SingleLine(readonly=True) size = Integer(readonly=True) filename = SingleLine(readonly=True) attached_to = UniqueReferences(readonly=True, backref=True, reftype=AssetReference)
class NotificationSchema(MappingSchema): """Notification sheet data structure. `follow_resources`: Follow activities these resources are involved in. """ follow_resources = UniqueReferences(reftype=NotificationFollowReference, choices_getter=get_follow_choices) email_notification_enabled = Boolean(default=True, missing=drop)
class RateableSchema(colander.MappingSchema): """Commentable sheet data structure. `post_pool`: Pool to post new :class:`adhocracy_sample.resource.IRate`. """ rates = UniqueReferences(readonly=True, backref=True, reftype=RateObjectReference) post_pool = PostPool(iresource_or_service_name='rates')
class PoolSchema(MappingSchema): """Pool sheet data structure. `elements`: children of this resource (object hierarchy). """ elements = UniqueReferences( reftype=PoolElementsReference, readonly=True, )
class PermissionsSchema(colander.MappingSchema): """Permissions sheet data structure. `groups`: groups this user joined """ roles = Roles() groups = UniqueReferences(reftype=PermissionsGroupsReference) roles_and_group_roles = Roles(readonly=True, default=deferred_roles_and_group_roles)
class PolarizableSchema(MappingSchema): """Polarizable sheet data structure. `post_pool`: Pool to post :class:`adhocracy_core.resource.IPolarization`. """ polarizations = UniqueReferences(readonly=True, backref=True, reftype=PolarizationObjectReference) post_pool = PostPool(iresource_or_service_name='relations')
class CommentableSchema(colander.MappingSchema): """Commentable sheet data structure. `comments`: list of comments (not stored) `post_pool`: Pool to post new :class:`adhocracy_sample.resource.IComment`. """ comments = UniqueReferences(readonly=True, backref=True, reftype=CommentRefersToReference) post_pool = PostPool(iresource_or_service_name='comments')
class ParagraphSchema(MappingSchema): """Paragraph Section sheet data structure. `content`: Text `documents`: Documents referencing this paragraph """ text = Text() documents = UniqueReferences(reftype=DocumentElementsReference, readonly=True, backref=True)
class BadgeableSchema(MappingSchema): """Badgeable sheet data structure. `post_pool`: Pool to post new :class:`adhocracy_sample.resource.IBadgeAssignment`. """ assignments = UniqueReferences(readonly=True, backref=True, reftype=BadgeObjectReference) post_pool = PostPool(iresource_or_service_name='badge_assignments')
def make_one(self, **kwargs): from adhocracy_core.schema import UniqueReferences return UniqueReferences(**kwargs)
def _add_references_node(inst: colander.Schema): from adhocracy_core.schema import UniqueReferences reference_node = UniqueReferences(name='references') inst.add(reference_node)