--- a/server/test/data/migratedapp/schema.py Fri Apr 23 12:42:53 2010 +0200
+++ b/server/test/data/migratedapp/schema.py Fri Apr 23 13:25:02 2010 +0200
@@ -6,7 +6,7 @@
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
"""
from yams.buildobjs import (EntityType, RelationType, RelationDefinition,
- SubjectRelation, ObjectRelation,
+ SubjectRelation,
RichString, String, Int, Boolean, Datetime, Date)
from yams.constraints import SizeConstraint, UniqueConstraint
from cubicweb.schema import (WorkflowableEntityType, RQLConstraint,
@@ -82,7 +82,9 @@
constraints=[UniqueConstraint(), SizeConstraint(64)])
description = RichString(fulltextindexed=True)
- filed_under2 = ObjectRelation('*')
+class filed_under2(RelationDefinition):
+ subject ='*'
+ object = 'Folder2'
class Personne(EntityType):
--- a/server/test/data/schema.py Fri Apr 23 12:42:53 2010 +0200
+++ b/server/test/data/schema.py Fri Apr 23 13:25:02 2010 +0200
@@ -6,8 +6,7 @@
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
"""
from yams.buildobjs import (EntityType, RelationType, RelationDefinition,
- SubjectRelation, ObjectRelation,
- RichString, String, Int, Boolean, Datetime)
+ SubjectRelation, RichString, String, Int, Boolean, Datetime)
from yams.constraints import SizeConstraint
from cubicweb.schema import (WorkflowableEntityType, RQLConstraint,
ERQLExpression, RRQLExpression)
@@ -64,7 +63,10 @@
class SubDivision(Division):
__specializes_schema__ = True
- travaille_subdivision = ObjectRelation('Personne')
+
+class travaille_subdivision(RelationDefinition):
+ subject = 'Personne'
+ object = 'SubDivision'
from cubicweb.schemas.base import CWUser
CWUser.get_relations('login').next().fulltextindexed = True
@@ -72,7 +74,11 @@
class Note(WorkflowableEntityType):
date = String(maxsize=10)
type = String(maxsize=6)
- para = String(maxsize=512)
+ para = String(maxsize=512,
+ __permissions__ = {
+ 'read': ('managers', 'users', 'guests'),
+ 'update': ('managers', ERQLExpression('X in_state S, S name "todo"')),
+ })
migrated_from = SubjectRelation('Note')
attachment = SubjectRelation(('File', 'Image'))
@@ -91,31 +97,18 @@
tel = Int()
fax = Int()
datenaiss = Datetime()
- test = Boolean()
+ test = Boolean(__permissions__={
+ 'read': ('managers', 'users', 'guests'),
+ 'update': ('managers',),
+ })
description = String()
firstname = String(fulltextindexed=True, maxsize=64)
- travaille = SubjectRelation('Societe')
concerne = SubjectRelation('Affaire')
connait = SubjectRelation('Personne')
inline2 = SubjectRelation('Affaire', inlined=True, cardinality='?*')
- comments = ObjectRelation('Comment')
-class fiche(RelationType):
- inlined = True
- subject = 'Personne'
- object = 'Card'
- cardinality = '??'
-
-class multisource_inlined_rel(RelationType):
- inlined = True
- cardinality = '?*'
- subject = ('Card', 'Note')
- object = ('Affaire', 'Note')
-
-class ecrit_par(RelationType):
- inlined = True
class connait(RelationType):
symmetric = True
@@ -127,23 +120,30 @@
'delete': ('managers', RRQLExpression('O owned_by U')),
}
-class travaille(RelationType):
+class travaille(RelationDefinition):
__permissions__ = {
'read': ('managers', 'users', 'guests'),
'add': ('managers', RRQLExpression('U has_update_permission S')),
'delete': ('managers', RRQLExpression('O owned_by U')),
}
+ subject = 'Personne'
+ object = 'Societe'
-class para(RelationType):
- __permissions__ = {
- 'read': ('managers', 'users', 'guests'),
- 'update': ('managers', ERQLExpression('X in_state S, S name "todo"')),
- }
+class comments(RelationDefinition):
+ subject = 'Comment'
+ object = 'Personne'
-class test(RelationType):
- __permissions__ = {'read': ('managers', 'users', 'guests'),
- 'update': ('managers',),
- }
+class fiche(RelationDefinition):
+ inlined = True
+ subject = 'Personne'
+ object = 'Card'
+ cardinality = '??'
+
+class multisource_inlined_rel(RelationDefinition):
+ inlined = True
+ cardinality = '?*'
+ subject = ('Card', 'Note')
+ object = ('Affaire', 'Note')
class multisource_rel(RelationDefinition):
subject = ('Card', 'Note')
@@ -167,6 +167,9 @@
subject = ('Personne', 'CWUser', 'Societe')
object = ('Note')
+class ecrit_par(RelationType):
+ inlined = True
+
class ecrit_par_1(RelationDefinition):
name = 'ecrit_par'
subject = 'Note'
--- a/web/test/data/schema.py Fri Apr 23 12:42:53 2010 +0200
+++ b/web/test/data/schema.py Fri Apr 23 13:25:02 2010 +0200
@@ -6,8 +6,7 @@
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
"""
-from yams.buildobjs import (EntityType, RelationType, RelationDefinition,
- SubjectRelation, ObjectRelation,
+from yams.buildobjs import (EntityType, RelationDefinition, SubjectRelation,
String, Int, Datetime, Boolean, Float)
from yams.constraints import IntervalBoundConstraint
@@ -20,7 +19,7 @@
subject = 'Tag'
object = ('BlogEntry', 'CWUser')
-class checked_by(RelationType):
+class checked_by(RelationDefinition):
subject = 'BlogEntry'
object = 'CWUser'
cardinality = '?*'
@@ -45,7 +44,10 @@
description = String()
salary = Float()
travaille = SubjectRelation('Societe')
- connait = ObjectRelation('CWUser')
+
+class connait(RelationDefinition):
+ subject = 'CWUser'
+ object = 'Personne'
class Societe(EntityType):
nom = String(maxsize=64, fulltextindexed=True)