server/sources/pyrorql.py
branchstable
changeset 3016 5787d1cc8106
parent 2763 39b42e158249
child 3043 7bcb7f1c0f46
--- a/server/sources/pyrorql.py	Wed Aug 26 11:16:10 2009 +0200
+++ b/server/sources/pyrorql.py	Wed Aug 26 13:27:03 2009 +0200
@@ -26,6 +26,12 @@
 from cubicweb.server.sources import (AbstractSource, ConnectionWrapper,
                                      TimedCache, dbg_st_search, dbg_results)
 
+
+def uidtype(union, col, etype, args):
+    select, col = union.locate_subquery(col, etype, args)
+    return getattr(select.selection[col], 'uidtype', None)
+
+
 class ReplaceByInOperator(Exception):
     def __init__(self, eids):
         self.eids = eids
@@ -295,8 +301,8 @@
             needtranslation = []
             rows = rset.rows
             for i, etype in enumerate(descr[0]):
-                if (etype is None or not self.schema.eschema(etype).is_final() or
-                    getattr(union.locate_subquery(i, etype, args).selection[i], 'uidtype', None)):
+                if (etype is None or not self.schema.eschema(etype).is_final()
+                    or uidtype(union, i, etype, args)):
                     needtranslation.append(i)
             if needtranslation:
                 cnx = session.pool.connection(self.uri)