]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Fixed "concatenate tuple" bug which could occur with
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 7 May 2008 03:48:14 +0000 (03:48 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 7 May 2008 03:48:14 +0000 (03:48 +0000)
Query.order_by() if clause adaption had taken place.
[ticket:1027]

CHANGES
lib/sqlalchemy/orm/query.py
test/orm/query.py

diff --git a/CHANGES b/CHANGES
index a838247d4d0278f6021453963ee639197faec398..6c2de2878975ba76b4de985704bbb26ace059f37 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -22,7 +22,11 @@ CHANGES
       generation to handle placing bind params inside of
       functions and other expressions.  (partial progress
       towards [ticket:610])
-
+    
+    - Fixed "concatenate tuple" bug which could occur with
+      Query.order_by() if clause adaption had taken place.
+      [ticket:1027]
+      
     - Removed an ancient assertion that mapped selectables
       require "alias names" - the mapper creates its own alias
       now if none is present.  Though in this case you need to
index ae3ace7536f7e0d75984478151fe6507f302d718..8996a758e6c2954490fa7d76e10ff108762fc130 100644 (file)
@@ -571,8 +571,9 @@ class Query(object):
         q = self.__no_statement("order_by")
 
         if self._aliases_tail:
-            criterion = [expression._literal_as_text(o) for o in criterion]
-            criterion = self._aliases_tail.adapt_list(criterion)
+            criterion = tuple(self._aliases_tail.adapt_list(
+                    [expression._literal_as_text(o) for o in criterion]
+                    ))
 
         if q._order_by is False:
             q._order_by = criterion
index c3032182c4778dd857faa0cd3aafe7a45e367359..cdd50cb70701e7b9efc56d4f632b9c6603fc0ae8 100644 (file)
@@ -651,6 +651,12 @@ class JoinTest(QueryTest):
             sess.query(User).join([('orders', orderalias), ('items', itemalias)]).filter(orderalias.user_id==9).filter(itemalias.description=='item 4').all(),
             []
         )
+
+    def test_orderby_arg_bug(self):
+        sess = create_session()
+        
+        # no arg error
+        result = sess.query(User).join('orders', aliased=True).order_by([Order.id]).reset_joinpoint().order_by(users.c.id).all()
         
     def test_aliased_classes(self):
         sess = create_session()
@@ -741,7 +747,7 @@ class JoinTest(QueryTest):
 
             result = create_session().query(User).outerjoin(['orders', 'items'], aliased=aliased).filter_by(id=3).reset_joinpoint().outerjoin(['orders','address'], aliased=aliased).filter_by(id=1).all()
             assert [User(id=7, name='jack')] == result
-
+    
     def test_overlap_with_aliases(self):
         oalias = orders.alias('oalias')