コード例 #1
0
ファイル: files.py プロジェクト: tareqalam/guillotina
class IFile(Interface):

    metadata('extension', 'md5', 'content_type', 'filename')

    index('content_type', type='text')
    content_type = schema.BytesLine(
        title=u'Content Type',
        description=u'The content type identifies the type of data.',
        default=b'',
        required=False)

    index('filename', type='text')
    filename = schema.TextLine(title=u'Filename', required=False, default=None)

    data = schema.Bytes(
        title=u'Data',
        description=u'The actual content.',
        required=False,
    )

    index('extension', type='text')
    extension = schema.TextLine(title='Extension of the file', default='')

    index('md5', type='text')
    md5 = schema.TextLine(title='MD5', default='')

    size = schema.Int(title='Size', default=0)

    def get_size():
        """Return the byte-size of the data of the object."""
コード例 #2
0
ファイル: dublincore.py プロジェクト: tareqalam/guillotina
class IDublinCore(Interface):
    index('creators', type='keyword')
    index('tags', type='keyword')
    index('contributors', type='keyword')

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

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

    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.")

    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.")

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

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

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

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

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

    contributors = schema.Tuple(
        title=u'Contributors',
        description=u"The unqualified Dublin Core 'Contributor' element values",
        value_type=schema.TextLine())
コード例 #3
0
ファイル: testing.py プロジェクト: bsuttor/guillotina
class IExample(IResource):

    metadata('categories')

    index('categories', type='nested')
    categories = List(title='categories',
                      default=[],
                      value_type=JSONField(title='term', schema=TERM_SCHEMA))
コード例 #4
0
class IExample(IResource):

    metadata('categories')

    index('categories', type='nested')
    categories = schema.List(title='categories',
                             default=[],
                             value_type=schema.JSONField(title='term',
                                                         schema=TERM_SCHEMA))

    textline_field = schema.TextLine()
    text_field = schema.Text()
    dict_value = schema.Dict(key_type=schema.TextLine(),
                             value_type=schema.TextLine())
    datetime = schema.Datetime()
コード例 #5
0
class INews(IItem):

    index('text', type='text')
    text = schema.Text(title=_('Text'), required=False)
コード例 #6
0
class ILink(IItem):

    index('url', type='text')
    url = schema.TextLine(title=_('URL'), required=False)