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

    `elements`: Tags in this Pool
    """

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

    `elements`: Resources with this Tag
    """

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

    `elements`: structural subelements like sections
    """

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

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

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

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

    users = UniqueReferences(readonly=True,
                             backref=True,
                             reftype=PermissionsGroupsReference)
    roles = Roles()
示例#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)
示例#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)
示例#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)
示例#11
0
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)
示例#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')
示例#13
0
class PoolSchema(MappingSchema):
    """Pool sheet data structure.

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

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