[schema] rephrase relation definition since constraint doesn't apply to CWRelation stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 26 Jul 2011 11:21:26 +0200
branchstable
changeset 7690 015396b6e417
parent 7689 a86fd3ec322e
child 7691 c47dcd37d4e3
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
schemas/base.py
--- a/schemas/base.py	Tue Jul 26 11:01:17 2011 +0200
+++ b/schemas/base.py	Tue Jul 26 11:21:26 2011 +0200
@@ -323,14 +323,28 @@
     cw_for_source = SubjectRelation(
         'CWSource', inlined=True, cardinality='1*', composite='object',
         __permissions__=RELATION_MANAGERS_PERMISSIONS)
-    cw_schema = SubjectRelation(
-        ('CWEType', 'CWRType', 'CWRelation'),
-        inlined=True, cardinality='1*', composite='object',
-        constraints=[RQLConstraint('NOT O final TRUE')],
-        __permissions__=RELATION_MANAGERS_PERMISSIONS)
     options = String(description=_('allowed options depends on the source type'))
 
 
+class rtype_cw_schema(RelationDefinition):
+    __permissions__ = RELATION_MANAGERS_PERMISSIONS
+    name = 'cw_schema'
+    subject = 'CWSourceSchemaConfig'
+    object = ('CWEType', 'CWRType')
+    inlined = True
+    cardinality = '1*'
+    composite = 'object'
+    constraints = [RQLConstraint('NOT O final TRUE')]
+
+class rdef_cw_schema(RelationDefinition):
+    __permissions__ = RELATION_MANAGERS_PERMISSIONS
+    name = 'cw_schema'
+    subject = 'CWSourceSchemaConfig'
+    object = 'CWRelation'
+    inlined = True
+    cardinality = '1*'
+    composite = 'object'
+
 # "abtract" relation types, no definition in cubicweb itself ###################
 
 class identical_to(RelationType):