cleanup stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 17 Sep 2010 17:25:58 +0200
branchstable
changeset 6286 4d10e9895679
parent 6285 b8a2c9b9a2cb
child 6287 f4a0282c31a5
cleanup
server/sources/rql2sql.py
--- a/server/sources/rql2sql.py	Fri Sep 17 17:25:51 2010 +0200
+++ b/server/sources/rql2sql.py	Fri Sep 17 17:25:58 2010 +0200
@@ -1141,11 +1141,11 @@
 
     def visit_constant(self, constant):
         """generate SQL name for a constant"""
-        value = constant.value
         if constant.type is None:
             return 'NULL'
+        value = constant.value
         if constant.type == 'Int' and  isinstance(constant.parent, SortTerm):
-            return constant.value
+            return value
         if constant.type in ('Date', 'Datetime'):
             rel = constant.relation()
             if rel is not None:
@@ -1158,7 +1158,7 @@
                 # we may found constant from simplified var in varmap
                 return self._mapped_term(constant, '%%(%s)s' % value)[0]
             except KeyError:
-                _id = constant.value
+                _id = value
                 if isinstance(_id, unicode):
                     _id = _id.encode()
         else: