server/test/data/migratedapp/schema.py
author Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
Fri, 27 Aug 2010 08:56:58 +0200
branchstable
changeset 6163 407f54345687
parent 5575 8a531340c3ef
child 6208 07b176640a8c
permissions -rw-r--r--
[migration] fix add_relation_type() for symmetric relations To check if the corresponding SQL table has to created, CWRelationAddOp tests that the tablename is not in the 'createdtables' session variable (i.e. the table hasn't been created before in the same transaction) and that len(rschema.rdefs) is not greater to 1, that is the relation already existed in the database before this transaction. In case of symmetric relations, len(rschema).rdefs will be at least 2 since rdefs will store both (subj, obj) and (obj, subj) relation definitions.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
     1
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
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: 4467
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: 4467
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: 4467
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: 4467
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: 4467
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: 4467
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: 4467
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: 4467
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: 4467
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: 4467
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: 4467
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: 4467
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: 4467
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: 4467
diff changeset
    17
# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    18
"""
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    19
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    20
"""
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    21
from yams.buildobjs import (EntityType, RelationType, RelationDefinition,
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
    22
                            SubjectRelation,
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    23
                            RichString, String, Int, Boolean, Datetime, Date)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    24
from yams.constraints import SizeConstraint, UniqueConstraint
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    25
from cubicweb.schema import (WorkflowableEntityType, RQLConstraint,
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    26
                             ERQLExpression, RRQLExpression)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    27
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    28
class Affaire(EntityType):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
    29
    __permissions__ = {
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    30
        'read':   ('managers', 'users', 'guests'),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    31
        'add':    ('managers', ERQLExpression('X concerne S, S owned_by U')),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    32
        'update': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    33
        'delete': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    34
        }
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    35
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    36
    ref = String(fulltextindexed=True, indexed=True,
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    37
                 constraints=[SizeConstraint(16)])
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    38
    sujet = String(fulltextindexed=True,
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    39
                 constraints=[SizeConstraint(256)])
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    40
    concerne = SubjectRelation('Societe')
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    41
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    42
class concerne(RelationType):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
    43
    __permissions__ = {
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    44
        'read':   ('managers', 'users', 'guests'),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    45
        'add':    ('managers', RRQLExpression('U has_update_permission S')),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    46
        'delete': ('managers', RRQLExpression('O owned_by U')),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    47
        }
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    48
2963
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    49
class Para(EntityType):
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    50
    para = String(maxsize=512)
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    51
    newattr = String()
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    52
    newinlined = SubjectRelation('Affaire', cardinality='?*', inlined=True)
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    53
    newnotinlined = SubjectRelation('Affaire', cardinality='?*')
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    54
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    55
class Note(Para):
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    56
    __specializes_schema__ = True
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    57
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
    58
    __permissions__ = {'read':   ('managers', 'users', 'guests',),
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    59
                   'update': ('managers', 'owners',),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    60
                   'delete': ('managers', ),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    61
                   'add':    ('managers',
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    62
                              ERQLExpression('X ecrit_part PE, U in_group G, '
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    63
                                             'PE require_permission P, P name "add_note", '
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    64
                                             'P require_group G'),)}
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    65
3543
ed152fe5aa8b [migration] when adding a new attribute with a default value, set this value on existing entities (test and fix)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3134
diff changeset
    66
    whatever = Int(default=2)  # keep it before `date` for unittest_migraction.test_add_attribute_int
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    67
    date = Datetime()
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    68
    type = String(maxsize=1)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    69
    mydate = Date(default='TODAY')
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    70
    shortpara = String(maxsize=64)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    71
    ecrit_par = SubjectRelation('Personne', constraints=[RQLConstraint('S concerne A, O concerne A')])
5575
8a531340c3ef no more Image type w/ cw 3.9
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5426
diff changeset
    72
    attachment = SubjectRelation('File')
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    73
2963
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    74
class Text(Para):
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    75
    __specializes_schema__ = True
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    76
    summary = String(maxsize=512)
12ad88615a12 test and fix migration introducing base classes (w/ regard to yams inheritance)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
    77
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    78
class ecrit_par(RelationType):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
    79
    __permissions__ = {'read':   ('managers', 'users', 'guests',),
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    80
                   'delete': ('managers', ),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    81
                   'add':    ('managers',
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    82
                              RRQLExpression('O require_permission P, P name "add_note", '
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    83
                                             'U in_group G, P require_group G'),)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    84
                   }
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    85
    inlined = True
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    86
    cardinality = '?*'
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    87
2626
e297294dff12 F [server test] avoid warning by adding __init__.py file to directory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2592
diff changeset
    88
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    89
class Folder2(EntityType):
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    90
    """folders are used to classify entities. They may be defined as a tree.
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    91
    When you include the Folder entity, all application specific entities
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    92
    may then be classified using the "filed_under" relation.
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    93
    """
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    94
    name = String(required=True, indexed=True, internationalizable=True,
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    95
                  constraints=[UniqueConstraint(), SizeConstraint(64)])
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    96
    description = RichString(fulltextindexed=True)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    97
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
    98
class filed_under2(RelationDefinition):
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
    99
    subject ='*'
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
   100
    object = 'Folder2'
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   101
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   102
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   103
class Personne(EntityType):
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   104
    nom    = String(fulltextindexed=True, required=True, maxsize=64)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   105
    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: 3543
diff changeset
   106
    civility   = String(maxsize=1, default='M', fulltextindexed=True)
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   107
    promo  = String(vocabulary=('bon','pasbon'))
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   108
    titre  = String(fulltextindexed=True, maxsize=128)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   109
    adel   = String(maxsize=128)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   110
    ass    = String(maxsize=128)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   111
    web    = String(maxsize=128)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   112
    tel    = Int()
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   113
    fax    = Int()
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   114
    datenaiss = Datetime()
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   115
    test   = Boolean()
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   116
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   117
    travaille = SubjectRelation('Societe')
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   118
    concerne = SubjectRelation('Affaire')
2745
0dafa29ace1f [schema migration] test reproducing pb when deleting a relation definition with mandatory card and without removing the associated rtype + fix
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2637
diff changeset
   119
    concerne2 = SubjectRelation(('Affaire', 'Note'), cardinality='1*')
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
   120
    connait = SubjectRelation('Personne', symmetric=True)
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   121
2920
64322aa83a1d start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2745
diff changeset
   122
class Societe(WorkflowableEntityType):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
   123
    __permissions__ = {
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   124
        'read': ('managers', 'users', 'guests'),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   125
        'update': ('managers', 'owners'),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   126
        'delete': ('managers', 'owners'),
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   127
        'add': ('managers', 'users',)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   128
        }
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   129
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   130
    nom  = String(maxsize=64, fulltextindexed=True)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   131
    web  = String(maxsize=128)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   132
    tel  = Int()
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   133
    fax  = Int()
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   134
    rncs = String(maxsize=128)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   135
    ad1  = String(maxsize=128)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   136
    ad2  = String(maxsize=128)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   137
    ad3  = String(maxsize=128)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   138
    cp   = String(maxsize=12)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   139
    ville= String(maxsize=32)
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   140
6163
407f54345687 [migration] fix add_relation_type() for symmetric relations
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 5575
diff changeset
   141
class same_as(RelationDefinition):
407f54345687 [migration] fix add_relation_type() for symmetric relations
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 5575
diff changeset
   142
    subject = ('Societe',)
407f54345687 [migration] fix add_relation_type() for symmetric relations
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 5575
diff changeset
   143
    object = 'ExternalUri'
2592
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   144
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   145
class evaluee(RelationDefinition):
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   146
    subject = ('Personne', 'CWUser', 'Societe')
c97c4b56e6a0 rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   147
    object = ('Note')