[schema, ui] fix is_subobject to skip cw_source relation (else everything is considered as a subobject, since this relation is now composite)
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 08 Feb 2011 18:00:23 +0100
changeset 6951 cb6314b09e0f
parent 6950 8a17e6e34f0f
child 6952 7de13eb473e3
[schema, ui] fix is_subobject to skip cw_source relation (else everything is considered as a subobject, since this relation is now composite)
__pkginfo__.py
debian/control
schema.py
--- a/__pkginfo__.py	Tue Feb 08 14:18:18 2011 +0100
+++ b/__pkginfo__.py	Tue Feb 08 18:00:23 2011 +0100
@@ -43,7 +43,7 @@
     'logilab-common': '>= 0.54.0',
     'logilab-mtconverter': '>= 0.8.0',
     'rql': '>= 0.28.0',
-    'yams': '>= 0.30.1',
+    'yams': '>= 0.30.4',
     'docutils': '>= 0.6',
     #gettext                    # for xgettext, msgcat, etc...
     # web dependancies
--- a/debian/control	Tue Feb 08 14:18:18 2011 +0100
+++ b/debian/control	Tue Feb 08 18:00:23 2011 +0100
@@ -97,7 +97,7 @@
 Package: cubicweb-common
 Architecture: all
 XB-Python-Version: ${python:Versions}
-Depends: ${misc:Depends}, ${python:Depends}, graphviz, gettext, python-logilab-mtconverter (>= 0.8.0), python-logilab-common (>= 0.54.0), python-yams (>= 0.30.1), python-rql (>= 0.28.0), python-lxml
+Depends: ${misc:Depends}, ${python:Depends}, graphviz, gettext, python-logilab-mtconverter (>= 0.8.0), python-logilab-common (>= 0.54.0), python-yams (>= 0.30.4), python-rql (>= 0.28.0), python-lxml
 Recommends: python-simpletal (>= 4.0), python-crypto
 Conflicts: cubicweb-core
 Replaces: cubicweb-core
--- 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