Author: phd
Date: 2005-07-31 08:14:17 +0000 (Sun, 31 Jul 2005)
New Revision: 865
Modified:
trunk/SQLObject/sqlobject/inheritance/__init__.py
trunk/SQLObject/sqlobject/inheritance/iteration.py
trunk/SQLObject/sqlobject/main.py
Log:
Fixed bugs in transition to sqlmeta.
Modified: trunk/SQLObject/sqlobject/inheritance/__init__.py
===================================================================
--- trunk/SQLObject/sqlobject/inheritance/__init__.py 2005-07-31 08:13:48 UTC (rev 864)
+++ trunk/SQLObject/sqlobject/inheritance/__init__.py 2005-07-31 08:14:17 UTC (rev 865)
@@ -95,12 +95,12 @@
#DSM: Only do this once if possible at object creation and once for
#DSM: each new dynamic column to refresh the current class
if childUpdate or cls._parentClass:
- for col in cls._parentClass._columns:
+ for col in cls._parentClass.sqlmeta.columnList:
cname = col.name
if cname == 'childName': continue
setattr(cls, getterName(cname), eval(
'lambda self: self._parent.%s' % cname))
- if not col.kw.has_key('immutable') or not col.kw['immutable']:
+ if not col.immutable:
setattr(cls, setterName(cname), eval(
'lambda self, val: setattr(self._parent, %s, val)'
% repr(cname)))
@@ -133,7 +133,7 @@
#DSM: Only do this once if possible at object creation and once for
#DSM: each new dynamic join to refresh the current class
if childUpdate or cls._parentClass:
- for jdef in cls._parentClass._joins:
+ for jdef in cls._parentClass.sqlmeta.joins:
join = jdef.withClass(cls)
jname = join.joinMethodName
jarn = join.addRemoveName
@@ -170,11 +170,11 @@
delJoin = classmethod(delJoin)
def _notifyFinishClassCreation(cls):
- if not cls._columns:
+ if not cls.sqlmeta.columnList:
# There are no columns - call addColumn to propagate columns
# from parent classes to children
cls.addColumn(None)
- if not cls._joins:
+ if not cls.sqlmeta.joins:
# There are no joins - call addJoin to propagate joins
# from parent classes to children
cls.addJoin(None)
Modified: trunk/SQLObject/sqlobject/inheritance/iteration.py
===================================================================
--- trunk/SQLObject/sqlobject/inheritance/iteration.py 2005-07-31 08:13:48 UTC (rev 864)
+++ trunk/SQLObject/sqlobject/inheritance/iteration.py 2005-07-31 08:14:17 UTC (rev 865)
@@ -27,7 +27,7 @@
self._results = []
# Find the index of the childName column
childNameIdx = None
- columns = select.sourceClass.sqlmeta._columns
+ columns = select.sourceClass.sqlmeta.columnList
for i in range(len(columns)): # enumerate() is unavailable python 2.2
if columns[i].name == "childName":
childNameIdx = i
Modified: trunk/SQLObject/sqlobject/main.py
===================================================================
--- trunk/SQLObject/sqlobject/main.py 2005-07-31 08:13:48 UTC (rev 864)
+++ trunk/SQLObject/sqlobject/main.py 2005-07-31 08:14:17 UTC (rev 865)
@@ -270,7 +270,7 @@
cls.indexDefinitions = cls.indexDefinitions[:]
cls.joins = []
cls.joinDefinitions = cls.joinDefinitions[:]
-
+
setClass = classmethod(setClass)
############################################################
@@ -753,7 +753,7 @@
currentClass = cls
while currentClass._parentClass:
currentClass = currentClass._parentClass
- for column in currentClass.columnDefinitions.values():
+ for column in currentClass.sqlmeta.columnDefinitions.values():
if type(column) == col.ForeignKey: continue
setattr(cls.q, column.name,
getattr(currentClass.q, column.name))
@@ -1471,8 +1471,8 @@
def __init__(self, soObject):
self.soObject = soObject
self.protocol = 'sql'
-
+
########################################
## Utility functions (for external consumption)
########################################
|