Ejemplo n.º 1
0
class StateMeta(MappingSchema):
    """Workflow state."""

    title = SingleLine(missing='')
    description = Text(missing='')
    acm = ACM()
    display_only_to_roles = Roles(missing=[])
    """Hint for the fronted, this is not security related."""
Ejemplo n.º 2
0
class CommentSchema(colander.MappingSchema):
    """Comment sheet data structure.

    `content`:  Text
    """

    refers_to = Reference(reftype=CommentRefersToReference)
    content = Text()
Ejemplo n.º 3
0
class ProposalSchema(MappingSchema):
    """Data structure for plan stellungsname information."""

    name = SingleLine(missing=required)
    street_number = SingleLine(missing=required)
    postal_code_city = SingleLine(missing=required)
    email = Email()
    statement = Text(missing=required,
                     validator=Length(max=17500))
Ejemplo n.º 4
0
class HeardFromSchema(colander.MappingSchema):

    heard_from_colleague = Boolean()
    heard_from_website = Boolean()
    heard_from_newsletter = Boolean()
    heard_from_facebook = Boolean()
    # There is no heard_from_elsewhere Boolean, since that automatically
    # follows iff heard_elsewhere is not empty
    heard_elsewhere = Text()
Ejemplo n.º 5
0
class StateData(MappingSchema):
    """Resource specific data for a workflow state."""

    missing = drop
    default = None

    name = StateName()
    description = Text(missing='', default='')
    start_date = DateTime(missing=None, default=None)
Ejemplo n.º 6
0
class ProposalSchema(colander.MappingSchema):
    """Data structure for organizational information."""

    # TODO: check exact length restrictions

    budget = CurrencyAmount(missing=colander.required,
                            validator=colander.Range(min=0, max=50000))
    creator_participate = Boolean()
    location_text = SingleLine(validator=colander.Length(max=100))
    address = Text()
Ejemplo n.º 7
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)
Ejemplo n.º 8
0
class PartnersSchema(MappingSchema):
    has_partners = Boolean()
    partner1_name = SingleLine()
    partner1_website = URL()
    partner1_country = ISOCountryCode()
    partner2_name = SingleLine()
    partner2_website = URL()
    partner2_country = ISOCountryCode()
    partner3_name = SingleLine()
    partner3_website = URL()
    partner3_country = ISOCountryCode()
    other_partners = Text()
Ejemplo n.º 9
0
class EmbedSchema(MappingSchema):
    """Embed sheet data structure.

    `embed_code`: html code to embed the `context` resource in web pages.
    `external_url`: canonical URL that embeds the `context` resource.
    """

    embed_code = Text(
        default=deferred_default_embed_code,
        widget=TextAreaWidget(rows=10),
    )
    external_url = URL()
Ejemplo n.º 10
0
class TopicSchema(MappingSchema):
    topic = TopicEnums(validator=Length(min=1, max=2))
    topic_other = Text()

    def validator(self, node: SchemaNode, value: dict):
        """Extra validation depending on the status of the topic."""
        topics = value.get('topic', [])
        if 'other' in topics:
            if not value.get('topic_other', None):
                raise Invalid(node['topic_other'],
                              msg='Required if "other" in topic')
        if _has_duplicates(topics):
            raise Invalid(node['topic'], msg='Duplicates are not allowed')
Ejemplo n.º 11
0
class LocationSchema(MappingSchema):
    location = SingleLine()
    is_online = Boolean()
    has_link_to_ruhr = Boolean(missing=required, default=False)
    link_to_ruhr = Text()

    def validator(self, node, value):
        """Extra validation depending on the status of the location.

        Make `link_to_ruhr` required if `has_link_to_ruhr` == `True`.
        """
        has_link_to_ruhr = value.get('has_link_to_ruhr', None)
        if has_link_to_ruhr:
            if not value.get('link_to_ruhr', None):
                link_to_ruhr = node['link_to_ruhr']
                raise Invalid(link_to_ruhr,
                              msg='Required iff has_link_to_ruhr == True')
Ejemplo n.º 12
0
class IntroductionSchema(colander.MappingSchema):
    """Data structure for the proposal introduction."""

    teaser = Text(validator=colander.Length(min=1, max=300))
    picture = Reference(reftype=IntroImageReference)
Ejemplo n.º 13
0
class StorySchema(MappingSchema):
    story = Text(validator=Length(min=1, max=800))
Ejemplo n.º 14
0
class PartnersSchema(colander.MappingSchema):
    partners = Text(validator=colander.Length(min=1, max=800))
Ejemplo n.º 15
0
class StepsSchema(colander.MappingSchema):
    steps = Text(validator=colander.Length(min=1, max=800))
Ejemplo n.º 16
0
class FinancialPlanningSchema(MappingSchema):
    budget = CurrencyAmount(missing=required)
    requested_funding = CurrencyAmount(missing=required,
                                       validator=Range(min=1, max=50000))
    major_expenses = Text(missing=required)
Ejemplo n.º 17
0
class POSTReportAbuseViewRequestSchema(colander.Schema):

    """Schema for abuse reports."""

    url = URL(missing=colander.required)
    remark = Text(missing='')
Ejemplo n.º 18
0
class PartnersSchema(MappingSchema):
    partners = Text(validator=Length(min=1, max=800))
Ejemplo n.º 19
0
class ValueSchema(MappingSchema):
    value = Text(validator=Length(min=1, max=800))
Ejemplo n.º 20
0
class StepsSchema(MappingSchema):
    steps = Text(validator=Length(min=1, max=800))
Ejemplo n.º 21
0
class OutcomeSchema(MappingSchema):
    outcome = Text(validator=Length(min=1, max=800))
Ejemplo n.º 22
0
class DescriptionSchema(colander.MappingSchema):
    """Data structure for for proposal description."""

    description = Text(validator=colander.Length(min=1, max=1000))
Ejemplo n.º 23
0
class OutcomeSchema(colander.MappingSchema):
    outcome = Text(validator=colander.Length(min=1, max=800))
Ejemplo n.º 24
0
class PracticalRelevanceSchema(MappingSchema):
    """Datastruct for the challenge field."""

    practicalrelevance = Text(missing=required,
                              validator=Length(min=3, max=500))
Ejemplo n.º 25
0
class ValueSchema(colander.MappingSchema):
    value = Text(validator=colander.Length(min=1, max=800))
Ejemplo n.º 26
0
class POSTMessageUserViewRequestSchema(MappingSchema):
    """Schema for messages to a user."""

    recipient = Reference(missing=required, reftype=MessageUserReference)
    title = SingleLine(missing=required)
    text = Text(missing=required)
Ejemplo n.º 27
0
class ExperienceSchema(colander.MappingSchema):
    """Data structure for additional fields."""

    experience = Text()
Ejemplo n.º 28
0
 def make_one(self):
     from adhocracy_core.schema import Text
     return Text()
Ejemplo n.º 29
0
class POSTReportAbuseViewRequestSchema(MappingSchema):
    """Schema for abuse reports."""

    url = URL(missing=required)
    remark = Text(missing='')
Ejemplo n.º 30
0
class ExtraFundingSchema(MappingSchema):
    other_sources = Text(missing='')
    secured = Boolean(default=False)