]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- fix to compiled bind parameters to not mistakenly populate None
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 7 Nov 2007 21:48:16 +0000 (21:48 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 7 Nov 2007 21:48:16 +0000 (21:48 +0000)
    [ticket:853]

CHANGES
lib/sqlalchemy/sql/compiler.py

diff --git a/CHANGES b/CHANGES
index 51f659f61b21904f9c51537531dfb5b6e76e8f3b..23a8f8981a3e2b6eb8e5a26a69c293df32777703 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -42,6 +42,9 @@ CHANGES
 
   - fixed the close() method on Transaction when using strategy='threadlocal'
 
+  - fix to compiled bind parameters to not mistakenly populate None
+    [ticket:853]
+  
 - orm
   - eager loading with LIMIT/OFFSET applied no longer adds the primary 
     table joined to a limited subquery of itself; the eager loads now
index 9c8a6f56e3cf5948900d31d71715abf9a41c54f0..ba48422785113513accca04e5c24e0a737269093 100644 (file)
@@ -189,9 +189,13 @@ class DefaultCompiler(engine.Compiled):
         
         if params:
             pd = {}
-            for key, bindparam in self.binds.iteritems():
-                name = self.bind_names[bindparam]
-                pd[name] = params.get(key, bindparam.value)
+            for bindparam, name in self.bind_names.iteritems():
+                for paramname in (bindparam.key, bindparam.shortname, name):
+                    if paramname in params:
+                        pd[name] = params[paramname]
+                        break
+                else:
+                    pd[name] = bindparam.value
             return pd
         else:
             return dict([(self.bind_names[bindparam], bindparam.value) for bindparam in self.bind_names])