Author: phd
Date: 2006-10-31 10:49:33 -0700 (Tue, 31 Oct 2006)
New Revision: 2062
Modified:
home/phd/SQLObject/paramstyles/sqlobject/inheritance/__init__.py
Log:
Merged patches from the revisions 2058:2061 from the trunk
Modified: home/phd/SQLObject/paramstyles/sqlobject/inheritance/__init__.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/inheritance/__init__.py 2006-10-31 17:44:48 UTC (rev 2061)
+++ home/phd/SQLObject/paramstyles/sqlobject/inheritance/__init__.py 2006-10-31 17:49:33 UTC (rev 2062)
@@ -38,18 +38,21 @@
if registryClass.sqlmeta.table in tablesDict:
#DSM: By default, no parents are needed for the clauses
tableRegistry[registryClass] = registryClass
- for registryClass in allClasses:
- if registryClass.sqlmeta.table in tablesDict:
- currentClass = registryClass.sqlmeta.parentClass
- while currentClass:
- if tableRegistry.has_key(currentClass):
- #DSM: Must keep the last parent needed
- #DSM: (to limit the number of join needed)
- tableRegistry[registryClass] = currentClass
+ tableRegistryCopy = tableRegistry.copy()
+ for childClass in tableRegistryCopy:
+ if childClass not in tableRegistry:
+ continue
+ currentClass = childClass
+ while currentClass:
+ if tableRegistryCopy.has_key(currentClass):
+ if currentClass in tableRegistry:
#DSM: Remove this class as it is a parent one
#DSM: of a needed children
del tableRegistry[currentClass]
- currentClass = currentClass.sqlmeta.parentClass
+ #DSM: Must keep the last parent needed
+ #DSM: (to limit the number of join needed)
+ tableRegistry[childClass] = currentClass
+ currentClass = currentClass.sqlmeta.parentClass
#DSM: Table registry contains only the last children
#DSM: or standalone classes
parentClause = []
|