]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
added 'asc' and 'desc' to PropComparator....this should be placed at a lower level...
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 6 Aug 2007 23:23:03 +0000 (23:23 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 6 Aug 2007 23:23:03 +0000 (23:23 +0000)
as real ASC and DESC operators

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

index abaeff49c5a906b9bfe8e8070e75838eda5e7137..775892da129018bb954d421efc4046bd25fabd75 100644 (file)
@@ -369,6 +369,12 @@ class PropComparator(sql.ColumnOperators):
     def expression_element(self):
         return self.clause_element()
         
+    def desc(self):
+        return self.clause_element().desc()
+    
+    def asc(self):
+        return self.clause_element().desc()
+        
     def contains_op(a, b):
         return a.contains(b)
     contains_op = staticmethod(contains_op)
index e01c0e67d876befc0bd27bcd1e5683b5787e9865..9a7a437da975e157e0e21f6cded9a754d0acd90f 100644 (file)
@@ -196,7 +196,7 @@ class OperatorTest(QueryTest):
     def test_clauses(self):
         for (expr, compare) in (
             (func.max(User.id), "max(users.id)"),
-            (desc(User.id), "users.id DESC"),
+            (User.id.desc(), "users.id DESC"),
             (between(5, User.id, Address.id), ":literal BETWEEN users.id AND addresses.id"),
             # this one would require adding compile() to InstrumentedScalarAttribute.  do we want this ?
             #(User.id, "users.id")