]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Fixed the attribute shard example to check
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 26 Jun 2011 17:00:58 +0000 (13:00 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 26 Jun 2011 17:00:58 +0000 (13:00 -0400)
    for bind param callable correctly in 0.7
    style.

CHANGES
examples/sharding/attribute_shard.py

diff --git a/CHANGES b/CHANGES
index d8f71bbaee66cc18cc1f33fab0344dc061385cd9..c7695f488e716f690232da63d7966f09f7cb4ae1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -68,6 +68,10 @@ CHANGES
     correct foreign key in a multi-level
     inheritance situation.
 
+  - Fixed the attribute shard example to check
+    for bind param callable correctly in 0.7 
+    style.
+
 0.7.1
 =====
 - general
index b36b8a01db5dd4377698bf975707410b949889c1..5831d7ee39d1d2b219c0ee0ac63059e838c08fe2 100644 (file)
@@ -160,17 +160,19 @@ def _get_query_comparisons(query):
     comparisons = []
 
     def visit_bindparam(bind):
-        # visit a bind parameter.   Below we ensure
-        # that we get the value whether it was specified
-        # as part of query.params(), or is directly embedded
-        # in the bind's "value" attribute.
-        value = query._params.get(bind.key, bind.value)
-
-        # some ORM functions place the bind's value as a 
-        # callable for deferred evaulation.   Get that
-        # actual value here.
-        if callable(value):
-            value = value()
+        # visit a bind parameter.   
+
+        # check in _params for it first
+        if bind.key in query._params:
+            value = query._params[bind.key]
+        elif bind.callable:
+            # some ORM functions (lazy loading) 
+            # place the bind's value as a 
+            # callable for deferred evaulation. 
+            value = bind.callable()
+        else:
+            # just use .value
+            value = bind.value
 
         binds[bind] = value