Author: phd
Date: 2006-10-31 10:44:48 -0700 (Tue, 31 Oct 2006)
New Revision: 2061
Modified:
SQLObject/branches/0.7-bugfix/docs/News.txt
SQLObject/branches/0.7-bugfix/sqlobject/inheritance/__init__.py
Log:
A bugfix by Raphael Derosso Pereira <rap...@gm...> for a bug in InheritableSQLObject
related to the order of tableRegistry dictionary.
Modified: SQLObject/branches/0.7-bugfix/docs/News.txt
===================================================================
--- SQLObject/branches/0.7-bugfix/docs/News.txt 2006-10-31 17:44:30 UTC (rev 2060)
+++ SQLObject/branches/0.7-bugfix/docs/News.txt 2006-10-31 17:44:48 UTC (rev 2061)
@@ -15,11 +15,14 @@
* Fixed a number of unicode-related problems with newer MySQLdb.
+* If the DB API driver returns timedelta instead of time (MySQLdb does
+ this) it is converted to time; but if the timedelta has days an exception
+ is raised.
+
* Fixed a number of bugs in InheritableSQLObject related to foreign keys.
-* If the DB API driver returns timedelta instead of time (MySQLdb sometimes
- does this) it is converted to time; but if the timedelta has days an
- exception is raised.
+* Fixed a bug in InheritableSQLObject related to the order of tableRegistry
+ dictionary.
SQLObject 0.7.1
===============
Modified: SQLObject/branches/0.7-bugfix/sqlobject/inheritance/__init__.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/inheritance/__init__.py 2006-10-31 17:44:30 UTC (rev 2060)
+++ SQLObject/branches/0.7-bugfix/sqlobject/inheritance/__init__.py 2006-10-31 17:44:48 UTC (rev 2061)
@@ -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
- while currentClass._parentClass:
- currentClass = currentClass._parentClass
- 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]
+ #DSM: Must keep the last parent needed
+ #DSM: (to limit the number of join needed)
+ tableRegistry[childClass] = currentClass
+ currentClass = currentClass._parentClass
#DSM: Table registry contains only the last children
#DSM: or standalone classes
parentClause = []
|