Exemple #1
0
class IDublinCore(Interface):
    index_field('creators', type='keyword')
    index_field('tags', type='keyword')
    index_field('contributors', type='keyword')

    title = schema.TextLine(
        title=u'Title',
        description=u"The first unqualified Dublin Core 'Title' element value.",
        required=False)

    description = schema.Text(
        title=u'Description',
        description=u"The first unqualified Dublin Core 'Description' element value.",
        required=False)

    creation_date = schema.Datetime(
        title=u'Creation Date',
        description=u"The date and time that an object is created. "
                    u"\nThis is normally set automatically.",
        required=False)

    modification_date = schema.Datetime(
        title=u'Modification Date',
        description=u"The date and time that the object was last modified in a\n"
                    u"meaningful way.",
        required=False)

    effective_date = schema.Datetime(
        title=u'Effective Date',
        description=u"The date and time that an object should be published. ",
        required=False)

    expiration_date = schema.Datetime(
        title=u'Expiration Date',
        description=u"The date and time that the object should become unpublished.",
        required=False)

    creators = schema.Tuple(
        title=u'Creators',
        description=u"The unqualified Dublin Core 'Creator' element values",
        value_type=schema.TextLine(),
        required=False)

    tags = schema.Tuple(
        title=u'Tags',
        description=u"The unqualified Dublin Core 'Tags' element values",
        value_type=schema.TextLine(),
        required=False)

    publisher = schema.Text(
        title=u'Publisher',
        description=u"The first unqualified Dublin Core 'Publisher' element value.",
        required=False)

    contributors = schema.Tuple(
        title=u'Contributors',
        description=u"The unqualified Dublin Core 'Contributor' element values",
        value_type=schema.TextLine(),
        required=False)
Exemple #2
0
class IRichText(IObject):
    """A text field that stores MIME type
    """

    default_mime_type = schema.ASCIILine(
        title=_(u"Default MIME type"),
        default='text/html',
    )

    output_mime_type = schema.ASCIILine(title=_(u"Default output MIME type"),
                                        default='text/x-html-safe')

    allowed_mime_types = schema.Tuple(
        title=_(u"Allowed MIME types"),
        description=_(u"Set to None to disable checking"),
        default=None,
        required=False,
        value_type=schema.ASCIILine(title=u"MIME type"),
    )

    max_length = schema.Int(
        title=_(u'Maximum length'),
        description=_(u'in characters'),
        required=False,
        min=0,
        default=None,
    )
Exemple #3
0
class IMySocketBehavior(Interface):
    socket_urls = schema.Tuple(
        title="Socket_urls",
        description="The request used by the prepare() function",
        value_type=schema.TextLine(),
        required=False,
        naive=True,
        max_length=1000,
    )
class ITestSchema(Interface):

    text = schema.TextLine()
    integer = schema.Int()
    floating = schema.Float()
    list_of_text = schema.List(value_type=schema.TextLine())
    tuple_of_text = schema.Tuple(value_type=schema.TextLine())
    set_of_text = schema.Set(value_type=schema.TextLine())
    frozenset_of_text = schema.FrozenSet(value_type=schema.TextLine())
    dict_value = schema.Dict(key_type=schema.TextLine(),
                             value_type=schema.TextLine())
    datetime = schema.Datetime()
    date = schema.Date()
    time = schema.Time()
Exemple #5
0
class ITestSchema(Interface):

    text = schema.TextLine(required=False)
    integer = schema.Int(required=False)
    floating = schema.Float(required=False)
    list_of_text = schema.List(value_type=schema.TextLine(), required=False)
    tuple_of_text = schema.Tuple(value_type=schema.TextLine(), required=False)
    set_of_text = schema.Set(value_type=schema.TextLine(), required=False)
    frozenset_of_text = schema.FrozenSet(value_type=schema.TextLine(),
                                         required=False)
    dict_value = schema.Dict(key_type=schema.TextLine(),
                             value_type=schema.TextLine(),
                             required=False)
    datetime = schema.Datetime(required=False)
    date = schema.Date(required=False)
    time = schema.Time(required=False)

    patch_list = fields.PatchField(
        schema.List(value_type=schema.Dict(key_type=schema.Text(),
                                           value_type=schema.Text()),
                    required=False))
    patch_dict = fields.PatchField(schema.Dict(key_type=schema.Text(),
                                               value_type=schema.Text()),
                                   required=False)

    bucket_list = fields.BucketListField(bucket_len=10,
                                         required=False,
                                         value_type=schema.Dict(
                                             key_type=schema.Text(),
                                             value_type=schema.Text()))

    datetime_bucket_list = fields.BucketListField(bucket_len=10,
                                                  required=False,
                                                  value_type=schema.Datetime())

    nested_patch = fields.PatchField(
        schema.Dict(required=False,
                    key_type=schema.Text(),
                    value_type=fields.PatchField(
                        schema.List(value_type=schema.Object(
                            schema=INestFieldSchema)))))
Exemple #6
0
class ITestSchema(Interface):

    text = schema.TextLine(required=False)
    integer = schema.Int(required=False)
    floating = schema.Float(required=False)
    list_of_text = schema.List(value_type=schema.TextLine(), required=False)
    tuple_of_text = schema.Tuple(value_type=schema.TextLine(), required=False)
    set_of_text = schema.Set(value_type=schema.TextLine(), required=False)
    frozenset_of_text = schema.FrozenSet(value_type=schema.TextLine(),
                                         required=False)
    dict_value = schema.Dict(key_type=schema.TextLine(),
                             value_type=schema.TextLine(),
                             required=False)
    datetime = schema.Datetime(required=False)
    date = schema.Date(required=False)
    time = schema.Time(required=False)

    patch_list = fields.PatchField(
        schema.List(value_type=schema.Dict(key_type=schema.Text(),
                                           value_type=schema.Text()),
                    required=False))
    patch_list_int = fields.PatchField(
        schema.List(value_type=schema.Int(), required=False))
    patch_dict = fields.PatchField(schema.Dict(key_type=schema.Text(),
                                               value_type=schema.Text()),
                                   required=False)

    patch_int = fields.PatchField(schema.Int(default=22), required=False)

    patch_int_no_default = fields.PatchField(schema.Int(), required=False)

    bucket_list = fields.BucketListField(
        bucket_len=10,
        required=False,
        value_type=schema.Dict(key_type=schema.Text(),
                               value_type=schema.Text()),
    )

    datetime_bucket_list = fields.BucketListField(bucket_len=10,
                                                  required=False,
                                                  value_type=schema.Datetime())

    union_field = schema.UnionField(schema.Datetime(),
                                    schema.Int(),
                                    required=False)
    union_field_obj = schema.UnionField(schema.Object(IObjectA),
                                        schema.Object(schema=IObjectB),
                                        required=False)

    nested_patch = fields.PatchField(
        schema.Dict(
            required=False,
            key_type=schema.Text(),
            value_type=fields.PatchField(
                schema.List(value_type=schema.Object(
                    schema=INestFieldSchema))),
        ))

    dict_of_obj = schema.Dict(
        required=False,
        key_type=schema.Text(),
        value_type=schema.Object(schema=INestFieldSchema))

    patch_dict_of_obj = fields.PatchField(
        schema.Dict(required=False,
                    key_type=schema.Text(),
                    value_type=schema.Object(schema=INestFieldSchema)))

    patch_tuple = fields.PatchField(
        schema.Tuple(required=False,
                     value_type=schema.Text(schema=INestFieldSchema)))

    bucket_dict = fields.BucketDictField(bucket_len=10,
                                         required=False,
                                         key_type=schema.Text(),
                                         value_type=schema.Text())
Exemple #7
0
class IDublinCore(Interface):
    index_field("creators", type="keyword")
    index_field("tags", type="keyword")
    index_field("contributors", type="keyword")

    title = schema.TextLine(
        title="Title", description="The first unqualified Dublin Core 'Title' element value."
    )

    description = schema.Text(
        title="Description", description="The first unqualified Dublin Core 'Description' element value."
    )

    creation_date = schema.Datetime(
        title="Creation Date",
        description="The date and time that an object is created. " "\nThis is normally set automatically.",
    )

    modification_date = schema.Datetime(
        title="Modification Date",
        description="The date and time that the object was last modified in a\n" "meaningful way.",
    )

    effective_date = schema.Datetime(
        title="Effective Date", description="The date and time that an object should be published. "
    )

    expiration_date = schema.Datetime(
        title="Expiration Date", description="The date and time that the object should become unpublished."
    )

    creators = schema.Tuple(
        title="Creators",
        description="The unqualified Dublin Core 'Creator' element values",
        value_type=schema.TextLine(),
        required=False,
        naive=True,
        max_length=1000,
    )

    tags = PatchField(
        schema.Tuple(
            title="Tags",
            description="The unqualified Dublin Core 'Tags' element values",
            value_type=schema.TextLine(),
            required=False,
            naive=True,
            max_length=10000,
        )
    )

    publisher = schema.Text(
        title="Publisher", description="The first unqualified Dublin Core 'Publisher' element value."
    )

    contributors = schema.Tuple(
        title="Contributors",
        description="The unqualified Dublin Core 'Contributor' element values",
        value_type=schema.TextLine(),
        required=False,
        naive=True,
        max_length=10000,
    )