schema.py
changeset 6951 cb6314b09e0f
parent 6949 267ce7cf77f1
child 7085 36e91d19188b
--- a/schema.py	Tue Feb 08 14:18:18 2011 +0100
+++ b/schema.py	Tue Feb 08 18:00:23 2011 +0100
@@ -65,6 +65,8 @@
 NO_I18NCONTEXT = META_RTYPES | WORKFLOW_RTYPES
 NO_I18NCONTEXT.add('require_permission')
 
+SKIP_COMPOSITE_RELS = [('cw_source', 'subject')]
+
 # set of entity and relation types used to build the schema
 SCHEMA_TYPES = set((
     'CWEType', 'CWRType', 'CWAttribute', 'CWRelation',
@@ -368,6 +370,14 @@
                     msg = "can't use RRQLExpression on %s, use an ERQLExpression"
                     raise BadSchemaDefinition(msg % self.type)
 
+    def is_subobject(self, strict=False, skiprels=None):
+        if skiprels is None:
+            skiprels = SKIP_COMPOSITE_RELS
+        else:
+            skiprels += SKIP_COMPOSITE_RELS
+        return super(CubicWebEntitySchema, self).is_subobject(strict,
+                                                              skiprels=skiprels)
+
     def attribute_definitions(self):
         """return an iterator on attribute definitions