[SQL-CVS] r1517 - home/phd/SQLObject/paramstyles/sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <sub...@co...> - 2006-01-16 17:32:30
|
Author: phd
Date: 2006-01-16 10:32:21 -0700 (Mon, 16 Jan 2006)
New Revision: 1517
Modified:
home/phd/SQLObject/paramstyles/sqlobject/joins.py
Log:
Merged patches from the revisions 1513:1516 from the trunk
Modified: home/phd/SQLObject/paramstyles/sqlobject/joins.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/joins.py 2006-01-16 17:31:06 UTC (rev 1516)
+++ home/phd/SQLObject/paramstyles/sqlobject/joins.py 2006-01-16 17:32:21 UTC (rev 1517)
@@ -99,11 +99,22 @@
# @@: but we don't handle more complex expressions for orderings
if orderBy.startswith('-'):
orderBy = orderBy[1:]
- def cmper(a, b, attr=orderBy):
- return cmp(getattr(b, attr), getattr(a, attr))
+ reverse = True
else:
- def cmper(a, b, attr=orderBy):
- return cmp(getattr(a, attr), getattr(b, attr))
+ reverse = False
+
+ def cmper(a, b, attr=orderBy, rev=reverse):
+ a = getattr(a, attr)
+ b = getattr(b, attr)
+ if rev:
+ a, b = b, a
+ if a is None:
+ if b is None:
+ return 0
+ return -1
+ if b is None:
+ return 1
+ return cmp(a, b)
return cmper
# This is a one-to-many
|