Author: phd
Date: 2006-09-05 07:49:58 -0600 (Tue, 05 Sep 2006)
New Revision: 1902
Added:
SQLObject/branches/0.7-bugfix/sqlobject/inheritance/tests/testDestroyCascade.py
Modified:
SQLObject/branches/0.7-bugfix/sqlobject/main.py
Log:
Applied the patch 1546314: Fix bug 1546294.
Added: SQLObject/branches/0.7-bugfix/sqlobject/inheritance/tests/testDestroyCascade.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/inheritance/tests/testDestroyCascade.py (rev 0)
+++ SQLObject/branches/0.7-bugfix/sqlobject/inheritance/tests/testDestroyCascade.py 2006-09-05 13:49:58 UTC (rev 1902)
@@ -0,0 +1,20 @@
+from sqlobject import *
+from sqlobject.inheritance import *
+from sqlobject.tests.dbtest import *
+
+class TestCascade1(InheritableSQLObject):
+ dummy = IntCol()
+
+class TestCascade2(TestCascade1):
+ c = ForeignKey('TestCascade3', cascade='null')
+
+class TestCascade3(SQLObject):
+ dummy = IntCol()
+
+
+def test_destroySelf():
+ setupClass([TestCascade1, TestCascade3, TestCascade2])
+
+ c = TestCascade3(dummy=1)
+ b = TestCascade2(cID=c.id, dummy=1)
+ c.destroySelf()
Modified: SQLObject/branches/0.7-bugfix/sqlobject/main.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/main.py 2006-09-05 13:45:01 UTC (rev 1901)
+++ SQLObject/branches/0.7-bugfix/sqlobject/main.py 2006-09-05 13:49:58 UTC (rev 1902)
@@ -1442,7 +1442,7 @@
if col.cascade == False:
# Found a restriction
restrict = True
- query.append("%s = (%s)" % (col.dbName, self.id))
+ query.append(getattr(k.q, col.name) == self.id)
if col.cascade == 'null':
setnull = col.name
elif col.cascade:
@@ -1451,7 +1451,7 @@
"Class %s depends on %s accoriding to "
"findDependantColumns, but this seems inaccurate"
% (k, klass))
- query = ' OR '.join(query)
+ query = sqlbuilder.OR(*query)
results = k.select(query, connection=self._connection)
if restrict:
if results.count():
|