[entity/rset] replace scary warnings about ambiguous rdefs by XXX in the code
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 03 Apr 2014 19:56:05 +0200
changeset 9820 3ad221fe04aa
parent 9817 bb719d857421
child 9827 c7ce035aede8
[entity/rset] replace scary warnings about ambiguous rdefs by XXX in the code users can't do anything about that and shouldn't see those warnings.
entity.py
rset.py
--- a/entity.py	Wed Jun 11 10:16:13 2014 +0200
+++ b/entity.py	Thu Apr 03 19:56:05 2014 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
 #
 # This file is part of CubicWeb.
@@ -344,7 +344,8 @@
                 cls.warning('skipping fetch_attr %s defined in %s (not found in schema)',
                             attr, cls.__regid__)
                 continue
-            rdef = eschema.rdef(attr)
+            # XXX takefirst=True to remove warning triggered by ambiguous inlined relations
+            rdef = eschema.rdef(attr, takefirst=True)
             if not user.matching_groups(rdef.get_groups('read')):
                 continue
             if rschema.final or rdef.cardinality[0] in '?1':
@@ -793,8 +794,9 @@
             # skip already defined relations
             if getattr(self, rschema.type):
                 continue
+            # XXX takefirst=True to remove warning triggered by ambiguous relations
+            rdef = self.e_schema.rdef(rschema, takefirst=True)
             # skip composite relation
-            rdef = self.e_schema.rdef(rschema)
             if rdef.composite:
                 continue
             # skip relation with card in ?1 else we either change the copied
@@ -813,7 +815,8 @@
                 continue
             if rschema.type in skip_copy_for['object']:
                 continue
-            rdef = self.e_schema.rdef(rschema, 'object')
+            # XXX takefirst=True to remove warning triggered by ambiguous relations
+            rdef = self.e_schema.rdef(rschema, 'object', takefirst=True)
             # skip composite relation
             if rdef.composite:
                 continue
--- a/rset.py	Wed Jun 11 10:16:13 2014 +0200
+++ b/rset.py	Thu Apr 03 19:56:05 2014 +0200
@@ -541,7 +541,8 @@
                 else:
                     attr_cols[attr] = i
             else:
-                rdef = eschema.rdef(attr, role)
+                # XXX takefirst=True to remove warning triggered by ambiguous relations
+                rdef = eschema.rdef(attr, role, takefirst=True)
                 # only keep value if it can't be multivalued
                 if rdef.role_cardinality(role) in '1?':
                     rel_cols[(attr, role)] = i