server/test/data/schema.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 23 Jul 2009 15:57:15 +0200
changeset 2459 d088d0ff48a1
parent 2455 5346d9f3d5ec
child 2503 c4bf7ef8b851
permissions -rw-r--r--
move RichString and co to yams, keeping only a small monkeypatch for cw-page-template here
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     1
"""
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     2
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     3
:organization: Logilab
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     4
:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     5
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     6
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     7
"""
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     8
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     9
class Affaire(WorkflowableEntityType):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    10
    permissions = {
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    11
        'read':   ('managers',
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    12
                   ERQLExpression('X owned_by U'), ERQLExpression('X concerne S?, S owned_by U')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    13
        'add':    ('managers', ERQLExpression('X concerne S, S owned_by U')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    14
        'update': ('managers', 'owners', ERQLExpression('X in_state S, S name in ("pitetre", "en cours")')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    15
        'delete': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    16
        }
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    17
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    18
    ref = String(fulltextindexed=True, indexed=True,
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    19
                 constraints=[SizeConstraint(16)])
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    20
    sujet = String(fulltextindexed=True,
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    21
                   constraints=[SizeConstraint(256)])
2459
d088d0ff48a1 move RichString and co to yams, keeping only a small monkeypatch for cw-page-template here
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2455
diff changeset
    22
    descr = RichString(fulltextindexed=True,
d088d0ff48a1 move RichString and co to yams, keeping only a small monkeypatch for cw-page-template here
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2455
diff changeset
    23
                       description=_('more detailed description'))
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    24
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    25
    duration = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    26
    invoiced = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    27
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    28
    depends_on = SubjectRelation('Affaire')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    29
    require_permission = SubjectRelation('CWPermission')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    30
    concerne = SubjectRelation(('Societe', 'Note'))
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    31
    todo_by = SubjectRelation('Personne')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    32
    documented_by = SubjectRelation('Card')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    33
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    34
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    35
class Societe(EntityType):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    36
    permissions = {
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    37
        'read': ('managers', 'users', 'guests'),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    38
        'update': ('managers', 'owners', ERQLExpression('U login L, X nom L')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    39
        'delete': ('managers', 'owners', ERQLExpression('U login L, X nom L')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    40
        'add': ('managers', 'users',)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    41
        }
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    42
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    43
    nom  = String(maxsize=64, fulltextindexed=True)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    44
    web  = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    45
    type  = String(maxsize=128) # attribute in common with Note
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    46
    tel  = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    47
    fax  = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    48
    rncs = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    49
    ad1  = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    50
    ad2  = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    51
    ad3  = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    52
    cp   = String(maxsize=12)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    53
    ville= String(maxsize=32)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    54
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    55
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    56
class Division(Societe):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    57
    __specializes_schema__ = True
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    58
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    59
class SubDivision(Division):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    60
    __specializes_schema__ = True
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    61
    travaille_subdivision = ObjectRelation('Personne')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    62
2455
5346d9f3d5ec [tests] fixes (including two operations renaming)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2349
diff changeset
    63
from cubicweb.schemas.base import CWUser
5346d9f3d5ec [tests] fixes (including two operations renaming)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2349
diff changeset
    64
CWUser.get_relations('login').next().fulltextindexed = True
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    65
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    66
class Note(EntityType):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    67
    date = String(maxsize=10)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    68
    type = String(maxsize=6)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    69
    para = String(maxsize=512)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    70
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    71
    migrated_from = SubjectRelation('Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    72
    attachment = SubjectRelation(('File', 'Image'))
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    73
    inline1 = SubjectRelation('Affaire', inlined=True)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    74
    todo_by = SubjectRelation('CWUser')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    75
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    76
class Personne(EntityType):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    77
    nom    = String(fulltextindexed=True, required=True, maxsize=64)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    78
    prenom = String(fulltextindexed=True, maxsize=64)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    79
    sexe   = String(maxsize=1, default='M')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    80
    promo  = String(vocabulary=('bon','pasbon'))
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    81
    titre  = String(fulltextindexed=True, maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    82
    adel   = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    83
    ass    = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    84
    web    = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    85
    tel    = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    86
    fax    = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    87
    datenaiss = Datetime()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    88
    test   = Boolean()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    89
    description = String()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    90
    firstname = String(fulltextindexed=True, maxsize=64)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    91
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    92
    travaille = SubjectRelation('Societe')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    93
    concerne = SubjectRelation('Affaire')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    94
    connait = SubjectRelation('Personne')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    95
    inline2 = SubjectRelation('Affaire', inlined=True)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    96
    comments = ObjectRelation('Comment')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    97
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    98
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    99
class fiche(RelationType):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   100
    inlined = True
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   101
    subject = 'Personne'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   102
    object = 'Card'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   103
    cardinality = '??'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   104
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   105
class multisource_inlined_rel(RelationType):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   106
    inlined = True
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   107
    cardinality = '?*'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   108
    subject = ('Card', 'Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   109
    object = ('Affaire', 'Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   110
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   111
class ecrit_par(RelationType):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   112
    inlined = True
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   113
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   114
class connait(RelationType):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   115
    symetric = True
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   116
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   117
class concerne(RelationType):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   118
    permissions = {
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   119
        'read':   ('managers', 'users', 'guests'),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   120
        'add':    ('managers', RRQLExpression('U has_update_permission S')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   121
        'delete': ('managers', RRQLExpression('O owned_by U')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   122
        }
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   123
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   124
class travaille(RelationType):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   125
    permissions = {
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   126
        'read':   ('managers', 'users', 'guests'),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   127
        'add':    ('managers', RRQLExpression('U has_update_permission S')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   128
        'delete': ('managers', RRQLExpression('O owned_by U')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   129
        }
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   130
2455
5346d9f3d5ec [tests] fixes (including two operations renaming)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2349
diff changeset
   131
class para(RelationType):
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   132
    permissions = {
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   133
        'read':   ('managers', 'users', 'guests'),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   134
        'add':    ('managers', ERQLExpression('X in_state S, S name "todo"')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   135
        'delete': ('managers', ERQLExpression('X in_state S, S name "todo"')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   136
        }
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   137
2455
5346d9f3d5ec [tests] fixes (including two operations renaming)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2349
diff changeset
   138
class test(RelationType):
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   139
    permissions = {'read': ('managers', 'users', 'guests'),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   140
                   'delete': ('managers',),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   141
                   'add': ('managers',)}
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   142
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   143
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   144
class in_state(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   145
    subject = 'Note'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   146
    object = 'State'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   147
    cardinality = '1*'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   148
    constraints=[RQLConstraint('S is ET, O state_of ET')]
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   149
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   150
class wf_info_for(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   151
    subject = 'TrInfo'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   152
    object = 'Note'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   153
    cardinality = '1*'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   154
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   155
class multisource_rel(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   156
    subject = ('Card', 'Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   157
    object = 'Note'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   158
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   159
class multisource_crossed_rel(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   160
    subject = ('Card', 'Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   161
    object = 'Note'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   162
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   163
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   164
class see_also(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   165
    subject = ('Bookmark', 'Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   166
    object = ('Bookmark', 'Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   167
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   168
class evaluee(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   169
    subject = ('Personne', 'CWUser', 'Societe')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   170
    object = ('Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   171
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   172
class ecrit_par_1(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   173
    name = 'ecrit_par'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   174
    subject = 'Note'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   175
    object ='Personne'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   176
    constraints = [RQLConstraint('E concerns P, X version_of P')]
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   177
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   178
class ecrit_par_2(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   179
    name = 'ecrit_par'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   180
    subject = 'Note'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   181
    object ='CWUser'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   182
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   183
class see_also(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   184
    subject = object = 'Folder'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   185
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   186
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   187
class copain(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   188
    subject = object = 'CWUser'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   189
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   190
class tags(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   191
    subject = 'Tag'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   192
    object = ('CWUser', 'CWGroup', 'State', 'Note', 'Card', 'Affaire')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   193
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   194
class filed_under(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   195
    subject = ('Note', 'Affaire')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   196
    object = 'Folder'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   197
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   198
class require_permission(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   199
    subject = ('Card', 'Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   200
    object = 'CWPermission'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   201
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   202
class require_state(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   203
    subject = 'CWPermission'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   204
    object = 'State'