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)
Exemple #2
0
class TagsSchema(colander.MappingSchema):
    """Tags sheet data structure.

    `elements`: Tags in this Pool
    """

    elements = UniqueReferences(reftype=TagsElementsReference)
Exemple #3
0
class TagSchema(colander.MappingSchema):
    """Tag sheet data structure.

    `elements`: Resources with this Tag
    """

    elements = UniqueReferences(reftype=TagElementsReference)
Exemple #4
0
class DocumentSchema(MappingSchema):
    """Document sheet data structure.

    `elements`: structural subelements like sections
    """

    elements = UniqueReferences(reftype=DocumentElementsReference)
Exemple #5
0
class VersionsSchema(MappingSchema):
    """Versions sheet data structure.

    `elements`: Dag for collecting all versions of one item.
    """

    elements = UniqueReferences(reftype=IVersionsElementsReference)
Exemple #6
0
class BadgeSchema(colander.MappingSchema):
    """Badge sheet data structure."""

    groups = UniqueReferences(reftype=BadgeGroupReference,
                              readonly=True,
                              default=deferred_groups_default,
                              )
Exemple #7
0
class GroupSchema(colander.MappingSchema):
    """Group sheet data structure."""

    users = UniqueReferences(readonly=True,
                             backref=True,
                             reftype=PermissionsGroupsReference)
    roles = Roles()
Exemple #8
0
class VersionableSchema(MappingSchema):
    """Versionable sheet data structure.

    Set/get predecessor (`follows`) versions of this resource.
    """

    follows = UniqueReferences(reftype=VersionableFollowsReference,
                               validator=deferred_validate_follows)
Exemple #9
0
class PermissionsSchema(MappingSchema):
    """Permissions sheet data structure.

    `groups`: groups this user joined
    """

    roles = Roles()
    groups = UniqueReferences(reftype=PermissionsGroupsReference,
                              choices_getter=get_group_choices)
Exemple #10
0
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)
Exemple #12
0
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')
Exemple #13
0
class PoolSchema(MappingSchema):
    """Pool sheet data structure.

    `elements`: children of this resource (object hierarchy).
    """

    elements = UniqueReferences(
        reftype=PoolElementsReference,
        readonly=True,
    )
Exemple #14
0
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)
Exemple #15
0
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')
Exemple #16
0
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')
Exemple #17
0
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)
Exemple #18
0
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')
Exemple #19
0
 def make_one(self, **kwargs):
     from adhocracy_core.schema import UniqueReferences
     return UniqueReferences(**kwargs)
Exemple #20
0
def _add_references_node(inst: colander.Schema):
    from adhocracy_core.schema import UniqueReferences
    reference_node = UniqueReferences(name='references')
    inst.add(reference_node)