backport stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 02 Jun 2010 16:15:05 +0200
changeset 5636 8138d9c86ac8
parent 5633 879590c52679 (current diff)
parent 5635 56784e46509f (diff)
child 5653 c562791df9d2
backport stable
test/unittest_entity.py
--- a/server/sources/rql2sql.py	Wed Jun 02 15:29:18 2010 +0200
+++ b/server/sources/rql2sql.py	Wed Jun 02 16:15:05 2010 +0200
@@ -1180,14 +1180,15 @@
     def _temp_table_scope(self, select, table):
         scope = 9999
         for var, sql in self._varmap.iteritems():
-            if table == sql.split('.', 1)[0]:
+            # skip "attribute variable" in varmap (such 'T.login')
+            if not '.' in var and table == sql.split('.', 1)[0]:
                 try:
                     scope = min(scope, self._state.scopes[select.defined_vars[var].scope])
                 except KeyError:
                     scope = 0 # XXX
                 if scope == 0:
-                    return 0
-        return 0
+                    break
+        return scope
 
     def _var_info(self, var):
         try:
--- a/test/unittest_entity.py	Wed Jun 02 15:29:18 2010 +0200
+++ b/test/unittest_entity.py	Wed Jun 02 16:15:05 2010 +0200
@@ -362,7 +362,7 @@
                                   '''<div class="highlight"><pre><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="mi">1</span>
 </pre></div>
 ''')
-            else
+            else:
                 self.assertEquals(e.printable_value('data'),
                                   '''<div class="highlight"><pre><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="mf">1</span>
 </pre></div>