author | Julien Cristau <julien.cristau@logilab.fr> |
Mon, 05 Dec 2011 13:37:40 +0100 | |
changeset 8105 | 7980b36fb1aa |
parent 7711 | 458cb2edf63a |
child 9299 | c5eed908117d |
child 9565 | fa00fc251d57 |
permissions | -rw-r--r-- |
7711
458cb2edf63a
[repo test] Fix test broken by BFSSTestable
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
6790
diff
changeset
|
1 |
# copyright 2003-2011 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:
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/>. |
6790
f4f67ea5436a
[schema migration] add a test to ensure default value are considered
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6292
diff
changeset
|
18 |
"""cw.server.migraction test""" |
2592
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
19 |
from yams.buildobjs import (EntityType, RelationType, RelationDefinition, |
7711
458cb2edf63a
[repo test] Fix test broken by BFSSTestable
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
6790
diff
changeset
|
20 |
SubjectRelation, Bytes, |
2592
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
21 |
RichString, String, Int, Boolean, Datetime, Date) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
22 |
from yams.constraints import SizeConstraint, UniqueConstraint |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
23 |
from cubicweb.schema import (WorkflowableEntityType, RQLConstraint, |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
24 |
ERQLExpression, RRQLExpression) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
25 |
|
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
26 |
class Affaire(EntityType): |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3546
diff
changeset
|
27 |
__permissions__ = { |
2592
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
28 |
'read': ('managers', 'users', 'guests'), |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
29 |
'add': ('managers', ERQLExpression('X concerne S, S owned_by U')), |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
30 |
'update': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')), |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
31 |
'delete': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')), |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
32 |
} |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
33 |
|
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
34 |
ref = String(fulltextindexed=True, indexed=True, |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
35 |
constraints=[SizeConstraint(16)]) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
36 |
sujet = String(fulltextindexed=True, |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
37 |
constraints=[SizeConstraint(256)]) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
38 |
concerne = SubjectRelation('Societe') |
7711
458cb2edf63a
[repo test] Fix test broken by BFSSTestable
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
6790
diff
changeset
|
39 |
opt_attr = Bytes() |
2592
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
40 |
|
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
41 |
class concerne(RelationType): |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3546
diff
changeset
|
42 |
__permissions__ = { |
2592
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
43 |
'read': ('managers', 'users', 'guests'), |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
44 |
'add': ('managers', RRQLExpression('U has_update_permission S')), |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
45 |
'delete': ('managers', RRQLExpression('O owned_by U')), |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
46 |
} |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
47 |
|
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
|
48 |
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
|
49 |
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
|
50 |
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
|
51 |
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
|
52 |
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
|
53 |
|
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 |
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
|
55 |
__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
|
56 |
|
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3546
diff
changeset
|
57 |
__permissions__ = {'read': ('managers', 'users', 'guests',), |
2592
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
58 |
'update': ('managers', 'owners',), |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
59 |
'delete': ('managers', ), |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
60 |
'add': ('managers', |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
61 |
ERQLExpression('X ecrit_part PE, U in_group G, ' |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
62 |
'PE require_permission P, P name "add_note", ' |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
63 |
'P require_group G'),)} |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
64 |
|
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
|
65 |
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
|
66 |
date = Datetime() |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
67 |
type = String(maxsize=1) |
6292
054fa36060d5
[migractions] add a dropped_constraints() migration command
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
6208
diff
changeset
|
68 |
unique_id = String(maxsize=1, required=True, unique=True) |
2592
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
69 |
mydate = Date(default='TODAY') |
6790
f4f67ea5436a
[schema migration] add a test to ensure default value are considered
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6292
diff
changeset
|
70 |
shortpara = String(maxsize=64, default='hop') |
2592
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): |
6208
07b176640a8c
unique_together integration in CW (alf+syt)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
6163
diff
changeset
|
104 |
__unique_together__ = [('nom', 'prenom', 'datenaiss')] |
2592
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
105 |
nom = String(fulltextindexed=True, required=True, maxsize=64) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
106 |
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
|
107 |
civility = String(maxsize=1, default='M', fulltextindexed=True) |
2592
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
108 |
promo = String(vocabulary=('bon','pasbon')) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
109 |
titre = String(fulltextindexed=True, maxsize=128) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
110 |
adel = String(maxsize=128) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
111 |
ass = String(maxsize=128) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
112 |
web = String(maxsize=128) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
113 |
tel = Int() |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
114 |
fax = Int() |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
115 |
datenaiss = Datetime() |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
116 |
test = Boolean() |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
117 |
|
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
118 |
travaille = SubjectRelation('Societe') |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
119 |
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
|
120 |
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
|
121 |
connait = SubjectRelation('Personne', symmetric=True) |
2592
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
122 |
|
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
|
123 |
|
7980b36fb1aa
[schema sync] Update repo._type_source_cache when renaming an entity (closes #2094470)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7711
diff
changeset
|
124 |
class New(EntityType): |
7980b36fb1aa
[schema sync] Update repo._type_source_cache when renaming an entity (closes #2094470)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7711
diff
changeset
|
125 |
new_name = String() |
7980b36fb1aa
[schema sync] Update repo._type_source_cache when renaming an entity (closes #2094470)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7711
diff
changeset
|
126 |
|
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2745
diff
changeset
|
127 |
class Societe(WorkflowableEntityType): |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3546
diff
changeset
|
128 |
__permissions__ = { |
2592
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
129 |
'read': ('managers', 'users', 'guests'), |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
130 |
'update': ('managers', 'owners'), |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
131 |
'delete': ('managers', 'owners'), |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
132 |
'add': ('managers', 'users',) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
133 |
} |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
134 |
nom = String(maxsize=64, fulltextindexed=True) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
135 |
web = String(maxsize=128) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
136 |
tel = Int() |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
137 |
fax = Int() |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
138 |
rncs = String(maxsize=128) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
139 |
ad1 = String(maxsize=128) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
140 |
ad2 = String(maxsize=128) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
141 |
ad3 = String(maxsize=128) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
142 |
cp = String(maxsize=12) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
143 |
ville= String(maxsize=32) |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
144 |
|
6163
407f54345687
[migration] fix add_relation_type() for symmetric relations
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
5575
diff
changeset
|
145 |
class same_as(RelationDefinition): |
407f54345687
[migration] fix add_relation_type() for symmetric relations
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
5575
diff
changeset
|
146 |
subject = ('Societe',) |
407f54345687
[migration] fix add_relation_type() for symmetric relations
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
5575
diff
changeset
|
147 |
object = 'ExternalUri' |
2592
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
148 |
|
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
149 |
class evaluee(RelationDefinition): |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
150 |
subject = ('Personne', 'CWUser', 'Societe') |
c97c4b56e6a0
rewrite migrscheam
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
151 |
object = ('Note') |