[Z3-sqlos] obj.destroySelf() broken in sqlos

Andrew Bennetts andrew-sqlos at puzzling.org
Wed Oct 20 20:06:00 CEST 2004


Using destroySelf on an SQLOS instance will cause the transaction to fail
due to an exception, because sqlos will attempt to call obj.sync() on a now
invalid object.

Currently, sqlos just intercepts writes to the dirty flag, and adds objects
to a list to be synced at the end of the transaction, but never removes from
this list (except at the end of a transaction).  I see that SQLObject's
implementation of destroySelf invokes
"self._connection.cache.expire(self.id, self.__class__)" to keep it's
object cache consistent... perhaps sqlos should use that cache, rather than
manage its own seperate one?

I'll try to write a test-case to demonstrate this soon.

A nasty workaround is to add this to the SQLOS class:

    def sync(self):
        if self._SO_obsolete:
            return
        SQLObject.sync(self)

But I don't believe this is the correct fix.

-Andrew.




More information about the z3-sqlos mailing list