Hi
I had some trouble with cascade='null' not being acted on when using
deleteMany instead of destroySelf.
I managed to reproduce it with a simple example. When running the following
code:
from sqlobject import *
class Abc(SQLObject):
field1 = StringCol()
final = ForeignKey('Abc', cascade='null')
sources = MultipleJoin('Abc', joinColumn = 'finalID')
def main():
conn = connectionForURI('sqlite:/:memory:')
sqlhub.processConnection = conn
#Abc._connection.debug = True
Abc.createTable()
a1 = Abc(field1='hello', final = None)
a2 = Abc(field1='goodbye', final = a1)
a3 = Abc(field1='gram', final = None)
a4 = Abc(field1='shmidt', final = a3)
a3.destroySelf()
Abc.deleteMany(Abc.q.field1=='hello')
print list(Abc.select())
if __name__ == '__main__':
main()
The output is:
[<Abc 2 field1='goodbye' finalID=1>, <Abc 4 field1='shmidt' finalID=None>]
I would expect that both objects would have finalID set to None.
I'd appreciate any help with this.
Cheers,
Imri
--
Imri Goldberg
--------------------------------------
www.algorithm.co.il/blogs/
--------------------------------------
-- insert signature here ----
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss