cubicweb/server/test/data/cubicweb_file/schema.py
changeset 12515 2d43c8b30ef0
equal deleted inserted replaced
12514:eac7f5b20f9f 12515:2d43c8b30ef0
       
     1 from yams.buildobjs import EntityType, String, Bytes, RichString
       
     2 
       
     3 
       
     4 class File(EntityType):
       
     5     """a downloadable file which may contains binary data"""
       
     6     title = String(fulltextindexed=True, maxsize=256)
       
     7     data = Bytes(required=True, description='file to upload')
       
     8     data_format = String(
       
     9         required=True, maxsize=128,
       
    10         description=('MIME type of the file. Should be dynamically set '
       
    11                      'at upload time.'))
       
    12     data_encoding = String(
       
    13         maxsize=32,
       
    14         description=('encoding of the file when it applies (e.g. text). '
       
    15                      'Should be dynamically set at upload time.'))
       
    16     data_name = String(
       
    17         required=True, fulltextindexed=True,
       
    18         description=('name of the file. Should be dynamically set '
       
    19                      'at upload time.'))
       
    20     data_hash = String(
       
    21         maxsize=256,  # max len of currently available hash alg + prefix is 140
       
    22         description=('hash of the file. May be set at upload time.'),
       
    23         __permissions__={'read': ('managers', 'users', 'guests'),
       
    24                          'add': (),
       
    25                          'update': ()})
       
    26     description = RichString(fulltextindexed=True, internationalizable=True,
       
    27                              default_format='text/rest')