From: Mike Bayer Date: Wed, 7 Nov 2007 21:48:16 +0000 (+0000) Subject: - fix to compiled bind parameters to not mistakenly populate None X-Git-Tag: rel_0_4_1~45 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4b6881af557baf36ba04766fd92bbca88dc515b5;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - fix to compiled bind parameters to not mistakenly populate None [ticket:853] --- diff --git a/CHANGES b/CHANGES index 51f659f61b..23a8f8981a 100644 --- 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 diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 9c8a6f56e3..ba48422785 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -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])