[SQL-CVS] r1682 - SQLObject/branches/0.7-bugfix/sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <sub...@co...> - 2006-04-05 14:32:51
|
Author: phd
Date: 2006-04-05 08:32:39 -0600 (Wed, 05 Apr 2006)
New Revision: 1682
Modified:
SQLObject/branches/0.7-bugfix/sqlobject/joins.py
Log:
A patch by Luke Opperman: SQLJoins do not respect sqlmeta._perConnection.
Modified: SQLObject/branches/0.7-bugfix/sqlobject/joins.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/joins.py 2006-04-05 14:32:26 UTC (rev 1681)
+++ SQLObject/branches/0.7-bugfix/sqlobject/joins.py 2006-04-05 14:32:39 UTC (rev 1682)
@@ -152,7 +152,11 @@
class SOSQLMultipleJoin(SOMultipleJoin):
def performJoin(self, inst):
- results = self.otherClass.select(getattr(self.otherClass.q, self.soClass.sqlmeta.style.dbColumnToPythonAttr(self.joinColumn)) == inst.id)
+ if inst.sqlmeta._perConnection:
+ conn = inst._connection
+ else:
+ conn = None
+ results = self.otherClass.select(getattr(self.otherClass.q, self.soClass.sqlmeta.style.dbColumnToPythonAttr(self.joinColumn)) == inst.id, connection=conn)
if self.orderBy is NoDefault:
self.orderBy = self.otherClass.sqlmeta.defaultOrder
return results.orderBy(self.orderBy)
@@ -237,12 +241,17 @@
%(otherTable)s.%(otherID)s = %(interTable)s.%(otherCol)s and
%(interTable)s.%(joinCol)s = %(table)s.%(ID)s and
%(table)s.%(ID)s = %(idValue)s''' % options
+ if inst.sqlmeta._perConnection:
+ conn = inst._connection
+ else:
+ conn = None
results = self.otherClass.select(sqlbuilder.SQLConstant(clause),
clauseTables=(
options['table'],
options['otherTable'],
options['interTable'],
- )
+ ),
+ connection=conn
)
# TODO (michelts): apply orderBy on the selection
return results
|