Esempio n. 1
0
class CWAttribute(EntityType):
    """define a final relation: link a final relation type from a non final
    entity to a final entity type.

    used to build the instance schema
    """
    __permissions__ = PUB_SYSTEM_ENTITY_PERMS
    relation_type = SubjectRelation('CWRType', cardinality='1*',
                                    constraints=[RQLConstraint('O final TRUE')],
                                    composite='object')
    from_entity = SubjectRelation('CWEType', cardinality='1*',
                                  constraints=[RQLConstraint('O final FALSE')],
                                  composite='object')
    to_entity = SubjectRelation('CWEType', cardinality='1*',
                                constraints=[RQLConstraint('O final TRUE')],
                                composite='object')
    constrained_by = SubjectRelation('CWConstraint', cardinality='*1', composite='subject')

    cardinality = String(maxsize=2, internationalizable=True,
                         vocabulary=[_('?1'), _('11')],
                         description=_('subject/object cardinality'))
    ordernum = Int(description=('control subject entity\'s relations order'), default=0)

    formula = String(maxsize=2048)
    indexed = Boolean(description=_('create an index for quick search on this attribute'))
    fulltextindexed = Boolean(description=_('index this attribute\'s value in the plain text index'))
    internationalizable = Boolean(description=_('is this attribute\'s value translatable'))
    defaultval = Bytes(description=_('default value as gziped pickled python object'))
    extra_props = Bytes(description=_('additional type specific properties'))

    description = RichString(internationalizable=True,
                             description=_('semantic description of this attribute'))
Esempio n. 2
0
class Affaire(WorkflowableEntityType):
    __permissions__ = {
        'read': ('managers', ERQLExpression('X owned_by U'),
                 ERQLExpression('X concerne S?, S owned_by U')),
        'add': ('managers', ERQLExpression('X concerne S, S owned_by U')),
        'update':
        ('managers', 'owners',
         ERQLExpression('X in_state S, S name in ("pitetre", "en cours")')),
        'delete':
        ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')),
    }

    ref = String(fulltextindexed=True,
                 indexed=True,
                 constraints=[SizeConstraint(16)])
    sujet = String(fulltextindexed=True, constraints=[SizeConstraint(256)])
    descr = RichString(fulltextindexed=True,
                       description=_('more detailed description'))

    duration = Int()
    invoiced = Float()
    opt_attr = Bytes()

    depends_on = SubjectRelation('Affaire')
    require_permission = SubjectRelation('CWPermission')
    concerne = SubjectRelation(('Societe', 'Note'))
    todo_by = SubjectRelation('Personne', cardinality='?*')
    documented_by = SubjectRelation('Card')
Esempio n. 3
0
class Personne(EntityType):
    __unique_together__ = [('nom', 'prenom', 'inline2')]
    nom = String(fulltextindexed=True, required=True, maxsize=64)
    prenom = String(fulltextindexed=True, maxsize=64)
    sexe = String(maxsize=1, default='M', fulltextindexed=True)
    promo = String(vocabulary=('bon', 'pasbon'))
    titre = String(fulltextindexed=True, maxsize=128)
    adel = String(maxsize=128)
    ass = String(maxsize=128)
    web = String(maxsize=128)
    tel = Int()
    fax = Int()
    datenaiss = Datetime()
    tzdatenaiss = TZDatetime()
    test = Boolean(
        __permissions__={
            'read': ('managers', 'users', 'guests'),
            'add': ('managers', ),
            'update': ('managers', ),
        })
    description = String()
    firstname = String(fulltextindexed=True, maxsize=64)
    photo = Bytes()

    concerne = SubjectRelation('Affaire')
    connait = SubjectRelation('Personne')
    inline2 = SubjectRelation('Affaire', inlined=True, cardinality='?*')
Esempio n. 4
0
class RestrictedFile(EntityType):
    """ A downloadable file which may contains binary data
    """
    title = String(required=True, indexed=True, maxsize=256)
    data = Bytes(required=True,
                 fulltextindexed=True,
                 description=_('file to upload'))
    data_format = String(
        required=True,
        maxsize=128,
        description=_('MIME type of the file. Should be dynamically set at '
                      'upload time.'))
    data_encoding = String(
        maxsize=32,
        description=_('encoding of the file when it applies (e.g. text). '
                      'Should be dynamically set at upload time.'))
    data_name = String(
        required=True,
        fulltextindexed=True,
        description=_('name of the file. Should be dynamically set at upload '
                      'time.'))
    data_sha1hex = String(
        maxsize=40,
        description=_('SHA1 sum of the file. May be set at upload time.'))
    description = RichString(fulltextindexed=True,
                             internationalizable=True,
                             default_format='text/rest')
Esempio n. 5
0
class File(EntityType):
    """a downloadable file which may contains binary data"""
    title = String(fulltextindexed=True, maxsize=256)
    data = Bytes(required=True, description='file to upload')
    data_format = String(
        required=True,
        maxsize=128,
        description=('MIME type of the file. Should be dynamically set '
                     'at upload time.'))
    data_encoding = String(
        maxsize=32,
        description=('encoding of the file when it applies (e.g. text). '
                     'Should be dynamically set at upload time.'))
    data_name = String(
        required=True,
        fulltextindexed=True,
        description=('name of the file. Should be dynamically set '
                     'at upload time.'))
    data_hash = String(
        maxsize=256,  # max len of currently available hash alg + prefix is 140
        description=('hash of the file. May be set at upload time.'),
        __permissions__={
            'read': ('managers', 'users', 'guests'),
            'add': (),
            'update': ()
        })
    description = RichString(fulltextindexed=True,
                             internationalizable=True,
                             default_format='text/rest')
Esempio n. 6
0
class Personne(EntityType):
    nom = String(required=True)
    prenom = String()
    enfant = SubjectRelation('Personne', inlined=True, cardinality='?*')
    connait = SubjectRelation('Personne',
                              symmetric=True,
                              constraints=[RQLConstraint('NOT S identity O')])
    photo = Bytes()
Esempio n. 7
0
class _AbstractTimeSeries(EntityType):
    data_type = String(required=True,
                       vocabulary=[_('Float'),
                                   _('Integer'),
                                   _('Boolean')],
                       default=_('Float'))
    unit = String(
        maxsize=64,
        description=_('the unit in which the TimeSeries data are expressed'))

    data = Bytes(required=True, description=_('Timeseries data'))
Esempio n. 8
0
class NonPeriodicTimeSeries(_AbstractTimeSeries):
    """Non Periodic Time Series"""
    granularity = String(override=True,
                         internationalizable=True,
                         vocabulary=[_('time_vector')],
                         default='time_vector')

    timestamps = Bytes(
        required=False,
        description=
        _('the array of timestamps. Mandatory but read from the same source as data'
          ))
Esempio n. 9
0
class CWSession(EntityType):
    """Persistent session.

    Used by cubicweb.pyramid to store the session data.
    """
    __permissions__ = {
        'read': ('managers', ),
        'add': (),
        'update': (),
        'delete': (),
    }
    cwsessiondata = Bytes()
Esempio n. 10
0
class Affaire(EntityType):
    __permissions__ = {
        'read':   ('managers', 'users', 'guests'),
        'add':    ('managers', ERQLExpression('X concerne S, S owned_by U')),
        'update': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')),
        'delete': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')),
        }

    ref = String(fulltextindexed=True, indexed=True,
                 constraints=[SizeConstraint(16)])
    sujet = String(fulltextindexed=True,
                 constraints=[SizeConstraint(256)])
    concerne = SubjectRelation('Societe')
    opt_attr = Bytes()
Esempio n. 11
0
class MRIData(EntityType):
    sequence = String(maxsize=128, indexed=True)
    shape_x = Int(indexed=False)
    shape_y = Int(indexed=False)
    shape_z = Int(indexed=False)
    shape_t = Int(indexed=False)
    voxel_res_x = Float(indexed=False)
    voxel_res_y = Float(indexed=False)
    voxel_res_z = Float(indexed=False)
    fov_x = Float(indexed=False)
    fov_y = Float(indexed=False)
    tr = Float()
    te = Float(indexed=False)
    field = String(maxsize=10, indexed=False)
    affine = Bytes()
Esempio n. 12
0
class FakeFile(EntityType):
    title = String(fulltextindexed=True, maxsize=256)
    data = Bytes(required=True,
                 fulltextindexed=True,
                 description=_('file to upload'))
    data_format = String(
        required=True,
        maxsize=128,
        description=_(
            'MIME type of the file. Should be dynamically set at upload time.')
    )
    data_encoding = String(
        maxsize=32,
        description=_('encoding of the file when it applies (e.g. text). '
                      'Should be dynamically set at upload time.'))
    data_name = String(
        required=True,
        fulltextindexed=True,
        description=_(
            'name of the file. Should be dynamically set at upload time.'))
    description = RichString(fulltextindexed=True,
                             internationalizable=True,
                             default_format='text/rest')
Esempio n. 13
0
class UploadFile(EntityType):
    """ An entity used to upload file which may contain binary data.

    Attributes
    ----------
    name: String (mandatory)
        name field used in form.
    data: Bytes (mandatory)
        contains the uploaded file.
    data_extension: String (mandatory)
        the uploaded file extension.
    data_name: String (mandatory)
        the uploaded file name.
    data_sha1hex: String (optional)
        SHA1 sum of the file.
    """

    # Set default permissions
    __permissions__ = UPLOAD_PERMISSIONS

    name = String(maxsize=64,
                  required=True,
                  description=unicode("name field used in form"))
    data = Bytes(required=True, description=unicode("file to upload"))
    data_extension = String(required=True,
                            maxsize=32,
                            description=unicode("the upload file extension."))
    data_name = String(required=True,
                       fulltextindexed=True,
                       description=unicode(
                           "name of the file. Should be dynamically set at "
                           "upload time."))
    data_sha1hex = String(
        maxsize=40,
        description=unicode(
            "SHA1 sum of the file. May be set at upload time."))
Esempio n. 14
0
class File(EntityType):
    """ A downloadable file which may contains binary data.
    """
    __permissions__ = {
        "read": (
            "managers",
            ERQLExpression("X owned_by U"),
        ),
        "add": ("managers", "users"),
        "delete": ("managers", "owners"),
        "update": ("managers", "owners"),
    }
    title = String(fulltextindexed=True, maxsize=256)
    data = Bytes(required=True,
                 fulltextindexed=True,
                 description=_("file to upload"))
    data_format = String(
        required=True,
        maxsize=128,
        description=_("MIME type of the file. Should be dynamically set at "
                      "upload time."))
    data_encoding = String(
        maxsize=32,
        description=_("encoding of the file when it applies (e.g. text). "
                      "Should be dynamically set at upload time."))
    data_name = String(
        required=True,
        fulltextindexed=True,
        description=_("name of the file. Should be dynamically set at upload "
                      "time."))
    data_sha1hex = String(
        maxsize=40,
        description=_("SHA1 sum of the file. May be set at upload time."))
    description = RichString(fulltextindexed=True,
                             internationalizable=True,
                             default_format="text/rest")
Esempio n. 15
0
class XFile(EntityType):
    """ does NOT belong to Project """
    data = Bytes()
Esempio n. 16
0
class XFile(EntityType):
    """ Belongs to Project, Version and Ticket """
    data = Bytes()