I'm retrofitting some code to use transactions and have run into a snag:
How do you pass a transaction to a table that does not have a class? Ex:
class Machine(SQLObject):
_cacheValue = False
....
os = RelatedJoin('OsT', intermediateTable='machine_os_assoc',
joinColumn='machine_id', otherColumn='os_id',
addRemoveName='Os')
class Os(SQLObject):
_cacheValue = False
....
machines = RelatedJoin('MachineT',
intermediateTable='machine_os_assoc',
joinColumn='os_id', otherColumn='machine_id')
When I instantiate Machine, I pass "connection=trans", where "trans" is a
transaction instance. For Machine, trans.rollback(), trans.commit(), and
trans.begin() all work as expected. However, if I call the .addOs()
method of my Machine instance, it uses the normal connection, *not* the
transaction. What is the correct way to make this work?
I can't just change the global __connection__ instance to be a
transaction, as that would break too much existing code...
Thanks!
-Ben
--
Ben Beuchler There is no spoon.
in...@em... -- The Matrix
|