author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Fri, 06 Aug 2010 17:37:06 +0200 | |
branch | stable |
changeset 6074 | f2580c7abc26 |
parent 5426 | 0d4853a6e5ee |
child 6246 | 62e25fac41cd |
permissions | -rw-r--r-- |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
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:
4252
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:
4252
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:
4252
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:
4252
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:
4252
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:
4252
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:
4252
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:
4252
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:
4252
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:
4252
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:
4252
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:
4252
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:
4252
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:
4252
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:
4252
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
2636
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
18 |
""" |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
19 |
|
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
20 |
""" |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
21 |
|
5386
4c92202ab130
[test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
22 |
from yams.buildobjs import (EntityType, RelationDefinition, SubjectRelation, |
2636
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
23 |
String, Int, Datetime, Boolean, Float) |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
24 |
from yams.constraints import IntervalBoundConstraint |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
25 |
|
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
26 |
class Salesterm(EntityType): |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
27 |
described_by_test = SubjectRelation('File', cardinality='1*', composite='subject') |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
28 |
amount = Int(constraints=[IntervalBoundConstraint(0, 100)]) |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
29 |
reason = String(maxsize=20, vocabulary=[u'canceled', u'sold']) |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
30 |
|
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
31 |
class tags(RelationDefinition): |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
32 |
subject = 'Tag' |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
33 |
object = ('BlogEntry', 'CWUser') |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
34 |
|
5386
4c92202ab130
[test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
35 |
class checked_by(RelationDefinition): |
2636
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
36 |
subject = 'BlogEntry' |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
37 |
object = 'CWUser' |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
38 |
cardinality = '?*' |
4078 | 39 |
__permissions__ = { |
2636
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
40 |
'add': ('managers',), |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
41 |
'read': ('managers', 'users'), |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
42 |
'delete': ('managers',), |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
43 |
} |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
44 |
|
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
45 |
class Personne(EntityType): |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
46 |
nom = String(fulltextindexed=True, required=True, maxsize=64) |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
47 |
prenom = String(fulltextindexed=True, maxsize=64) |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
48 |
sexe = String(maxsize=1, default='M') |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
49 |
promo = String(vocabulary=('bon','pasbon')) |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
50 |
titre = String(fulltextindexed=True, maxsize=128) |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
51 |
ass = String(maxsize=128) |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
52 |
web = String(maxsize=128) |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
53 |
tel = Int() |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
54 |
fax = Int() |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
55 |
datenaiss = Datetime() |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
56 |
test = Boolean() |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
57 |
description = String() |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
58 |
salary = Float() |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
59 |
travaille = SubjectRelation('Societe') |
5386
4c92202ab130
[test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
60 |
|
4c92202ab130
[test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
61 |
class connait(RelationDefinition): |
4c92202ab130
[test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
62 |
subject = 'CWUser' |
4c92202ab130
[test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
63 |
object = 'Personne' |
2636
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
64 |
|
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
65 |
class Societe(EntityType): |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
66 |
nom = String(maxsize=64, fulltextindexed=True) |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
67 |
web = String(maxsize=128) |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
68 |
type = String(maxsize=128) # attribute in common with Note |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
69 |
tel = Int() |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
70 |
fax = Int() |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
71 |
rncs = String(maxsize=128) |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
72 |
ad1 = String(maxsize=128) |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
73 |
ad2 = String(maxsize=128) |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
74 |
ad3 = String(maxsize=128) |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
75 |
cp = String(maxsize=12) |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
76 |
ville= String(maxsize=32) |
104291d9bd00
R [web test] rewrite schema with a single python module
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
77 |