[querier] Expand 'rdef' argument in InsertPlan.add_relation_def()
authorDenis Laxalde <denis.laxalde@logilab.fr>
Thu, 30 Nov 2017 11:00:01 +0100
changeset 12241 06deb43c23c3
parent 12240 8eb15566142f
child 12242 68ca7fe0ca29
[querier] Expand 'rdef' argument in InsertPlan.add_relation_def() Expand the 'rdef' tuple to improve readability. The 'rtype' value is not used at the moment, but will in the next changeset.
cubicweb/server/querier.py
--- a/cubicweb/server/querier.py	Thu Nov 30 11:20:58 2017 +0100
+++ b/cubicweb/server/querier.py	Thu Nov 30 11:00:01 2017 +0100
@@ -346,11 +346,12 @@
 
     def add_relation_def(self, rdef):
         """add an relation definition to build"""
+        edef, rtype, value = rdef
         self.r_defs.add(rdef)
-        if not isinstance(rdef[0], int):
-            self._r_subj_index.setdefault(rdef[0], []).append(rdef)
-        if not isinstance(rdef[2], int):
-            self._r_obj_index.setdefault(rdef[2], []).append(rdef)
+        if not isinstance(edef, int):
+            self._r_subj_index.setdefault(edef, []).append(rdef)
+        if not isinstance(value, int):
+            self._r_obj_index.setdefault(value, []).append(rdef)
 
     def substitute_entity_def(self, edef, edefs):
         """substitute an incomplete entity definition by a list of complete