diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-11-20 15:43:12 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-11-20 15:43:12 -0500 |
commit | ea55a4644c63358324ce4066c501c048c7a661a6 (patch) | |
tree | 5178212f990adab3b69a1b6a0b55e4a3aceed51e /lib/sqlalchemy/sql/compiler.py | |
parent | e3ca3a773ff8c36126fe584b69e380c67791e2bf (diff) | |
download | sqlalchemy-ea55a4644c63358324ce4066c501c048c7a661a6.tar.gz |
- bindparam() gets a new option "callable", which is a lambda or def
evaluated at execution time to determine the value. This replaces
the implicit recognition of callables sent as the primary value
of bindparam(), which was an undocumented behavior used by the ORM.
The argument is separated now so that values can be passed to
bindparams that are also callables without ambiguity, such
as user defined objects that include a __call__() method.
[ticket:1950]
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 6f0a45df9..8ca510e13 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -279,16 +279,16 @@ class SQLCompiler(engine.Compiled): raise exc.InvalidRequestError( "A value is required for bind parameter %r" % bindparam.key) - elif util.callable(bindparam.value): - pd[name] = bindparam.value() + elif bindparam.callable: + pd[name] = bindparam.callable() else: pd[name] = bindparam.value return pd else: pd = {} for bindparam in self.bind_names: - if util.callable(bindparam.value): - pd[self.bind_names[bindparam]] = bindparam.value() + if bindparam.callable: + pd[self.bind_names[bindparam]] = bindparam.callable() else: pd[self.bind_names[bindparam]] = bindparam.value return pd |