server/test/data/schema.py
author Rémi Cardona <remi.cardona@logilab.fr>
Tue, 15 Sep 2015 18:23:35 +0200
changeset 10682 7e111b606005
parent 10669 155c29e0ed1c
child 10817 7b154e0fa194
permissions -rw-r--r--
[py3k] unicode → six.text_type
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9981
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
     1
# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
     2
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
     3
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
     4
# This file is part of CubicWeb.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
     5
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
     6
# CubicWeb is free software: you can redistribute it and/or modify it under the
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
     7
# terms of the GNU Lesser General Public License as published by the Free
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
     8
# Software Foundation, either version 2.1 of the License, or (at your option)
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
     9
# any later version.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    10
#
5424
8ecbcbff9777 replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5421
diff changeset
    11
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    13
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    14
# details.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    15
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    16
# You should have received a copy of the GNU Lesser General Public License along
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    17
# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    18
10285
d14db30b90d6 [repository] don't attempt to delete computed relation, they have no table in the database. Closes #5162935
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 10114
diff changeset
    19
from yams.buildobjs import (EntityType, RelationType, RelationDefinition, ComputedRelation,
6081
ede33e6400ab [forms] test abs() rql function
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 5762
diff changeset
    20
                            SubjectRelation, RichString, String, Int, Float,
7694
bd56a29acaa8 [bfss] Fix update of BFSS attribute to None (close #1875289)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 7252
diff changeset
    21
                            Boolean, Datetime, TZDatetime, Bytes)
2503
c4bf7ef8b851 explicit imports
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2459
diff changeset
    22
from yams.constraints import SizeConstraint
6236
9138f23ee263 [repo tests] add test case for RQLUniqueConstraint
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6208
diff changeset
    23
from cubicweb.schema import (WorkflowableEntityType,
9138f23ee263 [repo tests] add test case for RQLUniqueConstraint
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6208
diff changeset
    24
                             RQLConstraint, RQLUniqueConstraint,
9565
fa00fc251d57 [migractions] Better handle removal of RQLConstraint in sync_schema
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8820
diff changeset
    25
                             RQLVocabularyConstraint,
2503
c4bf7ef8b851 explicit imports
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2459
diff changeset
    26
                             ERQLExpression, RRQLExpression)
2349
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
class Affaire(WorkflowableEntityType):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
    29
    __permissions__ = {
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    30
        'read':   ('managers',
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    31
                   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
    32
        '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
    33
        '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
    34
        '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
    35
        }
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    36
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    37
    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
    38
                 constraints=[SizeConstraint(16)])
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    39
    sujet = String(fulltextindexed=True,
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    40
                   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
    41
    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
    42
                       description=_('more detailed description'))
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    43
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    44
    duration = Int()
6081
ede33e6400ab [forms] test abs() rql function
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 5762
diff changeset
    45
    invoiced = Float()
7711
458cb2edf63a [repo test] Fix test broken by BFSSTestable
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 7694
diff changeset
    46
    opt_attr = Bytes()
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    47
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    48
    depends_on = SubjectRelation('Affaire')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    49
    require_permission = SubjectRelation('CWPermission')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    50
    concerne = SubjectRelation(('Societe', 'Note'))
2923
b97a0f8dd4dc fix test schema and update some tests to work again with wf changes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2920
diff changeset
    51
    todo_by = SubjectRelation('Personne', cardinality='?*')
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    52
    documented_by = SubjectRelation('Card')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    53
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
class Societe(EntityType):
8820
dbffb6959564 server/source/native: fix wrong usage of .lstrip that produce garbled error messages (closes #2777641)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8105
diff changeset
    56
    __unique_together__ = [('nom', 'type', 'cp')]
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
    57
    __permissions__ = {
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    58
        'read': ('managers', 'users', 'guests'),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    59
        '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
    60
        '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
    61
        'add': ('managers', 'users',)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    62
        }
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    63
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    64
    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
    65
    web  = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    66
    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
    67
    tel  = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    68
    fax  = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    69
    rncs = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    70
    ad1  = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    71
    ad2  = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    72
    ad3  = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    73
    cp   = String(maxsize=12)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    74
    ville= String(maxsize=32)
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
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    77
class Division(Societe):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    78
    __specializes_schema__ = True
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    79
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    80
class SubDivision(Division):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    81
    __specializes_schema__ = True
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    82
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    83
class travaille_subdivision(RelationDefinition):
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    84
    subject = 'Personne'
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    85
    object = 'SubDivision'
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    86
2455
5346d9f3d5ec [tests] fixes (including two operations renaming)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2349
diff changeset
    87
from cubicweb.schemas.base import CWUser
10669
155c29e0ed1c [py3k] use next builtin instead of next method
Rémi Cardona <remi.cardona@logilab.fr>
parents: 10646
diff changeset
    88
next(CWUser.get_relations('login')).fulltextindexed = True
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    89
2920
64322aa83a1d start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2608
diff changeset
    90
class Note(WorkflowableEntityType):
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    91
    date = String(maxsize=10)
10446
1e6655cff5ab add IUserFriendlyError adapter for violation of check constraints
Julien Cristau <julien.cristau@logilab.fr>
parents: 10303
diff changeset
    92
    type = String(vocabulary=[u'todo', u'a', u'b', u'T', u'lalala'])
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    93
    para = String(maxsize=512,
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    94
                  __permissions__ = {
9925
aee99876eb10 [test] Add missing attribute 'add' permission in test schema
Julien Cristau <julien.cristau@logilab.fr>
parents: 9600
diff changeset
    95
                      'add': ('managers', ERQLExpression('X in_state S, S name "todo"')),
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    96
                      'read':   ('managers', 'users', 'guests'),
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    97
                      'update': ('managers', ERQLExpression('X in_state S, S name "todo"')),
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    98
                      })
9395
96dba2efd16d [hooks/security] provide attribute "add" permission
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8820
diff changeset
    99
    something = String(maxsize=1,
96dba2efd16d [hooks/security] provide attribute "add" permission
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8820
diff changeset
   100
                      __permissions__ = {
96dba2efd16d [hooks/security] provide attribute "add" permission
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8820
diff changeset
   101
                          'read': ('managers', 'users', 'guests'),
96dba2efd16d [hooks/security] provide attribute "add" permission
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8820
diff changeset
   102
                          'add': (ERQLExpression('NOT X para NULL'),),
96dba2efd16d [hooks/security] provide attribute "add" permission
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8820
diff changeset
   103
                          'update': ('managers', 'owners')
96dba2efd16d [hooks/security] provide attribute "add" permission
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8820
diff changeset
   104
                      })
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   105
    migrated_from = SubjectRelation('Note')
5575
8a531340c3ef no more Image type w/ cw 3.9
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5426
diff changeset
   106
    attachment = SubjectRelation('File')
6236
9138f23ee263 [repo tests] add test case for RQLUniqueConstraint
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6208
diff changeset
   107
    inline1 = SubjectRelation('Affaire', inlined=True, cardinality='?*',
9138f23ee263 [repo tests] add test case for RQLUniqueConstraint
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6208
diff changeset
   108
                              constraints=[RQLUniqueConstraint('S type T, S inline1 A1, A1 todo_by C, '
9138f23ee263 [repo tests] add test case for RQLUniqueConstraint
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6208
diff changeset
   109
                                                              'Y type T, Y inline1 A2, A2 todo_by C',
9138f23ee263 [repo tests] add test case for RQLUniqueConstraint
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6208
diff changeset
   110
                                                               'S,Y')])
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   111
    todo_by = SubjectRelation('CWUser')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   112
9981
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   113
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   114
class Frozable(EntityType):
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   115
    __permissions__ = {
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   116
        'read':   ('managers', 'users'),
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   117
        'add':    ('managers', 'users'),
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   118
        'update': ('managers', ERQLExpression('X frozen False'),),
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   119
        'delete': ('managers', ERQLExpression('X frozen False'),)
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   120
    }
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   121
    name = String()
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   122
    frozen = Boolean(default=False,
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   123
                     __permissions__ = {
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   124
                         'read':   ('managers', 'users'),
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   125
                         'add':    ('managers', 'users'),
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   126
                         'update': ('managers', 'owners')
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   127
                         })
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   128
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   129
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   130
class Personne(EntityType):
10584
743ed2b13a6f [syncschema] only add to the `synchronized` set if all possible updates have been done
Aurelien Campeas <aurelien.campeas@pythonian.fr>
parents: 10114
diff changeset
   131
    __permissions__ = {
743ed2b13a6f [syncschema] only add to the `synchronized` set if all possible updates have been done
Aurelien Campeas <aurelien.campeas@pythonian.fr>
parents: 10114
diff changeset
   132
        'read':   ('managers', 'users', 'guests'), # 'guests' will be removed
743ed2b13a6f [syncschema] only add to the `synchronized` set if all possible updates have been done
Aurelien Campeas <aurelien.campeas@pythonian.fr>
parents: 10114
diff changeset
   133
        'add':    ('managers', 'users'),
743ed2b13a6f [syncschema] only add to the `synchronized` set if all possible updates have been done
Aurelien Campeas <aurelien.campeas@pythonian.fr>
parents: 10114
diff changeset
   134
        'update': ('managers', 'owners'),
743ed2b13a6f [syncschema] only add to the `synchronized` set if all possible updates have been done
Aurelien Campeas <aurelien.campeas@pythonian.fr>
parents: 10114
diff changeset
   135
        'delete': ('managers', 'owners')
743ed2b13a6f [syncschema] only add to the `synchronized` set if all possible updates have been done
Aurelien Campeas <aurelien.campeas@pythonian.fr>
parents: 10114
diff changeset
   136
    }
6208
07b176640a8c unique_together integration in CW (alf+syt)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 5762
diff changeset
   137
    __unique_together__ = [('nom', 'prenom', 'inline2')]
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   138
    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
   139
    prenom = String(fulltextindexed=True, maxsize=64)
3546
f0aecddf367e fix bug when renaming a full text indexed attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2923
diff changeset
   140
    sexe   = String(maxsize=1, default='M', fulltextindexed=True)
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   141
    promo  = String(vocabulary=('bon','pasbon'))
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   142
    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
   143
    adel   = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   144
    ass    = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   145
    web    = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   146
    tel    = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   147
    fax    = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   148
    datenaiss = Datetime()
7166
dde161937d3e [time zone] support for TZDatetime and TZTime data type
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6279
diff changeset
   149
    tzdatenaiss = TZDatetime()
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   150
    test   = Boolean(__permissions__={
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   151
        'read': ('managers', 'users', 'guests'),
9395
96dba2efd16d [hooks/security] provide attribute "add" permission
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8820
diff changeset
   152
        'add': ('managers',),
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   153
        'update': ('managers',),
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   154
        })
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   155
    description = String()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   156
    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
   157
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   158
    concerne = SubjectRelation('Affaire')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   159
    connait = SubjectRelation('Personne')
2608
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   160
    inline2 = SubjectRelation('Affaire', inlined=True, cardinality='?*')
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   161
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   162
8105
7980b36fb1aa [schema sync] Update repo._type_source_cache when renaming an entity (closes #2094470)
Julien Cristau <julien.cristau@logilab.fr>
parents: 7711
diff changeset
   163
class Old(EntityType):
10114
6f4b4567b77d [security] check attributes: dispatch on the "add" action if entity was just created
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9984
diff changeset
   164
    name = String(__permissions__ = {
6f4b4567b77d [security] check attributes: dispatch on the "add" action if entity was just created
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9984
diff changeset
   165
        'read'   : ('managers', 'users', 'guests'),
6f4b4567b77d [security] check attributes: dispatch on the "add" action if entity was just created
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9984
diff changeset
   166
        'add'    : ('managers', 'users', 'guests'),
6f4b4567b77d [security] check attributes: dispatch on the "add" action if entity was just created
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9984
diff changeset
   167
        'update' : ()
6f4b4567b77d [security] check attributes: dispatch on the "add" action if entity was just created
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9984
diff changeset
   168
    })
8105
7980b36fb1aa [schema sync] Update repo._type_source_cache when renaming an entity (closes #2094470)
Julien Cristau <julien.cristau@logilab.fr>
parents: 7711
diff changeset
   169
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   170
10487
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   171
class Email(EntityType):
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   172
    subject = String(fulltextindexed=True)
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   173
    messageid = String(required=True, indexed=True, unique=True)
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   174
    sender = SubjectRelation('EmailAddress', cardinality='?*')
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   175
    recipients = SubjectRelation('EmailAddress')
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   176
    attachment = SubjectRelation('File')
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   177
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   178
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   179
class EmailPart(EntityType):
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   180
    pass
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   181
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   182
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   183
class EmailThread(EntityType):
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   184
    see_also = SubjectRelation('EmailThread')
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   185
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   186
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   187
class connait(RelationType):
4467
0e73d299730a fix long-waiting symetric typo: should be spelled symmetric. Add auto database migration on schema deserialization
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
   188
    symmetric = True
2349
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 concerne(RelationType):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
   191
    __permissions__ = {
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   192
        'read':   ('managers', 'users', 'guests'),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   193
        '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
   194
        '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
   195
        }
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   196
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   197
class travaille(RelationDefinition):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
   198
    __permissions__ = {
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   199
        'read':   ('managers', 'users', 'guests'),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   200
        '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
   201
        '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
   202
        }
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   203
    subject = 'Personne'
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   204
    object = 'Societe'
9565
fa00fc251d57 [migractions] Better handle removal of RQLConstraint in sync_schema
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8820
diff changeset
   205
    constraints = [RQLVocabularyConstraint('S owned_by U'),
fa00fc251d57 [migractions] Better handle removal of RQLConstraint in sync_schema
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8820
diff changeset
   206
                   RQLVocabularyConstraint('S created_by U')]
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   207
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   208
class comments(RelationDefinition):
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   209
    subject = 'Comment'
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   210
    object = 'Personne'
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   211
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   212
class fiche(RelationDefinition):
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   213
    inlined = True
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   214
    subject = 'Personne'
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   215
    object = 'Card'
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   216
    cardinality = '??'
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   217
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   218
class multisource_inlined_rel(RelationDefinition):
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   219
    inlined = True
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   220
    cardinality = '?*'
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   221
    subject = ('Card', 'Note')
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   222
    object = ('Affaire', 'Note')
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   223
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   224
2608
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   225
class see_also_1(RelationDefinition):
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   226
    name = 'see_also'
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   227
    subject = object = 'Folder'
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   228
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   229
class see_also_2(RelationDefinition):
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   230
    name = 'see_also'
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   231
    subject = ('Bookmark', 'Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   232
    object = ('Bookmark', 'Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   233
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   234
class evaluee(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   235
    subject = ('Personne', 'CWUser', 'Societe')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   236
    object = ('Note')
9565
fa00fc251d57 [migractions] Better handle removal of RQLConstraint in sync_schema
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8820
diff changeset
   237
    constraints = [
fa00fc251d57 [migractions] Better handle removal of RQLConstraint in sync_schema
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8820
diff changeset
   238
        RQLVocabularyConstraint('S created_by U'),
fa00fc251d57 [migractions] Better handle removal of RQLConstraint in sync_schema
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8820
diff changeset
   239
        RQLVocabularyConstraint('S owned_by U'),
fa00fc251d57 [migractions] Better handle removal of RQLConstraint in sync_schema
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8820
diff changeset
   240
    ]
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   241
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   242
class ecrit_par(RelationType):
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   243
    inlined = True
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   244
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   245
class ecrit_par_1(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   246
    name = 'ecrit_par'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   247
    subject = 'Note'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   248
    object ='Personne'
2608
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   249
    cardinality = '?*'
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   250
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   251
class ecrit_par_2(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   252
    name = 'ecrit_par'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   253
    subject = 'Note'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   254
    object ='CWUser'
2608
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   255
    cardinality='?*'
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   256
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   257
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   258
class copain(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   259
    subject = object = 'CWUser'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   260
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   261
class tags(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   262
    subject = 'Tag'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   263
    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
   264
10303
593e63a68429 [server/test] Drop dependency on folder cube
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 10285
diff changeset
   265
class Folder(EntityType):
593e63a68429 [server/test] Drop dependency on folder cube
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 10285
diff changeset
   266
    """folders are used to classify entities. They may be defined as a tree.
593e63a68429 [server/test] Drop dependency on folder cube
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 10285
diff changeset
   267
    """
593e63a68429 [server/test] Drop dependency on folder cube
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 10285
diff changeset
   268
    name = String(required=True, indexed=True, internationalizable=True,
593e63a68429 [server/test] Drop dependency on folder cube
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 10285
diff changeset
   269
                  maxsize=64)
593e63a68429 [server/test] Drop dependency on folder cube
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 10285
diff changeset
   270
    description = RichString(fulltextindexed=True)
593e63a68429 [server/test] Drop dependency on folder cube
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 10285
diff changeset
   271
    filed_under = SubjectRelation('Folder', description=_('parent folder'))
593e63a68429 [server/test] Drop dependency on folder cube
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 10285
diff changeset
   272
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   273
class filed_under(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   274
    subject = ('Note', 'Affaire')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   275
    object = 'Folder'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   276
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   277
class require_permission(RelationDefinition):
2608
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   278
    subject = ('Card', 'Note', 'Personne')
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   279
    object = 'CWPermission'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   280
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   281
class require_state(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   282
    subject = 'CWPermission'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   283
    object = 'State'
7236
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   284
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   285
class personne_composite(RelationDefinition):
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   286
    subject='Personne'
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   287
    object='Personne'
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   288
    composite='subject'
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   289
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   290
class personne_inlined(RelationDefinition):
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   291
    subject='Personne'
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   292
    object='Personne'
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   293
    cardinality='?*'
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   294
    inlined=True
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   295
7238
576abb8c4626 fix implementation of repository.glob_add_relations (closes ##1625257)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7236
diff changeset
   296
576abb8c4626 fix implementation of repository.glob_add_relations (closes ##1625257)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7236
diff changeset
   297
class login_user(RelationDefinition):
576abb8c4626 fix implementation of repository.glob_add_relations (closes ##1625257)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7236
diff changeset
   298
    subject = 'Personne'
576abb8c4626 fix implementation of repository.glob_add_relations (closes ##1625257)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7236
diff changeset
   299
    object = 'CWUser'
576abb8c4626 fix implementation of repository.glob_add_relations (closes ##1625257)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7236
diff changeset
   300
    cardinality = '??'
7252
adb1673efa5f [sql generation] fix crash on outer join + ambiguous inlined relation + attribute selection
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7238
diff changeset
   301
adb1673efa5f [sql generation] fix crash on outer join + ambiguous inlined relation + attribute selection
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7238
diff changeset
   302
class ambiguous_inlined(RelationDefinition):
adb1673efa5f [sql generation] fix crash on outer join + ambiguous inlined relation + attribute selection
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7238
diff changeset
   303
    subject = ('Affaire', 'Note')
adb1673efa5f [sql generation] fix crash on outer join + ambiguous inlined relation + attribute selection
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7238
diff changeset
   304
    object = 'CWUser'
adb1673efa5f [sql generation] fix crash on outer join + ambiguous inlined relation + attribute selection
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7238
diff changeset
   305
    inlined = True
adb1673efa5f [sql generation] fix crash on outer join + ambiguous inlined relation + attribute selection
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7238
diff changeset
   306
    cardinality = '?*'
10285
d14db30b90d6 [repository] don't attempt to delete computed relation, they have no table in the database. Closes #5162935
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 10114
diff changeset
   307
d14db30b90d6 [repository] don't attempt to delete computed relation, they have no table in the database. Closes #5162935
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 10114
diff changeset
   308
d14db30b90d6 [repository] don't attempt to delete computed relation, they have no table in the database. Closes #5162935
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 10114
diff changeset
   309
class user_login(ComputedRelation):
d14db30b90d6 [repository] don't attempt to delete computed relation, they have no table in the database. Closes #5162935
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 10114
diff changeset
   310
    rule = 'O login_user S'