[SQL-CVS] r3081 - SQLObject/trunk/sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <sub...@co...> - 2007-10-16 14:46:35
|
Author: phd
Date: 2007-10-16 08:46:30 -0600 (Tue, 16 Oct 2007)
New Revision: 3081
Modified:
SQLObject/trunk/sqlobject/joins.py
SQLObject/trunk/sqlobject/main.py
SQLObject/trunk/sqlobject/sresults.py
Log:
Replaced "isinstance(o, t1) or isinstance(o, t2)" with "isinstance(o, (t1, t2))".
Modified: SQLObject/trunk/sqlobject/joins.py
===================================================================
--- SQLObject/trunk/sqlobject/joins.py 2007-10-16 14:12:21 UTC (rev 3080)
+++ SQLObject/trunk/sqlobject/joins.py 2007-10-16 14:46:30 UTC (rev 3081)
@@ -84,7 +84,7 @@
return results
def sorter(orderBy):
- if isinstance(orderBy, tuple) or isinstance(orderBy, list):
+ if isinstance(orderBy, (tuple, list)):
if len(orderBy) == 1:
orderBy = orderBy[0]
else:
Modified: SQLObject/trunk/sqlobject/main.py
===================================================================
--- SQLObject/trunk/sqlobject/main.py 2007-10-16 14:12:21 UTC (rev 3080)
+++ SQLObject/trunk/sqlobject/main.py 2007-10-16 14:46:30 UTC (rev 3081)
@@ -88,8 +88,7 @@
if len(setters) == 1 and setters.has_key('doc'):
continue
if d.has_key(var):
- if isinstance(d[var], types.MethodType) \
- or isinstance(d[var], types.FunctionType):
+ if isinstance(d[var], (types.MethodType, types.FunctionType)):
warnings.warn(
"I tried to set the property %r, but it was "
"already set, as a method (%r). Methods have "
Modified: SQLObject/trunk/sqlobject/sresults.py
===================================================================
--- SQLObject/trunk/sqlobject/sresults.py 2007-10-16 14:12:21 UTC (rev 3080)
+++ SQLObject/trunk/sqlobject/sresults.py 2007-10-16 14:46:30 UTC (rev 3081)
@@ -18,7 +18,7 @@
if ops.get('orderBy', sqlbuilder.NoDefault) is sqlbuilder.NoDefault:
ops['orderBy'] = sourceClass.sqlmeta.defaultOrder
orderBy = ops['orderBy']
- if isinstance(orderBy, list) or isinstance(orderBy, tuple):
+ if isinstance(orderBy, (tuple, list)):
orderBy = map(self._mungeOrderBy, orderBy)
else:
orderBy = self._mungeOrderBy(orderBy)
|