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

Sidnei da Silva sidnei at awkly.org
Wed Oct 20 21:19:11 CEST 2004


On Wed, Oct 20, 2004 at 09:11:26PM +0200, Andrew Bennetts wrote:
| > It uses that cache... except it has one per thread *wink*. The list of
| > objects to be synced is not a cache.
| 
| sqlos has one connection per thread, so there's also one SQLObject cache per
| thread...

Yes, that is correct. And when an ObjectExpired event is received, the
object is expired on every cache.

def sqlobjectExpiredSubscriber(event):
    obj = event.object

    if not ISQLObject.providedBy(obj): return

    from sqlos.connection import connCache
    for connection in connCache.values():
        connection.cache.expire(obj.id, obj.__class__)
....

| You're right that a cache isn't necessarily holding the same set of objects
| as the set that needs to by synced, but at a glance that seems to be true
| with SQLObject.  I'd want to do more than glance to be certain, though :)
| 
| It feels like unnecessary duplication to have SQLObject and sqlos both
| tracking objects independently, but on the other hand relying on SQLObject
| internals like that might be a bit fragile.

I don't think SQLObject tracks modified objects, but correct me if I'm
wrong. It's up to the developer to track modifications and call
syncUpdate() on the objects if you use lazyUpdates (which we do in
sqlos). The current approach seems ok for me.

| [...]
| > I would make the fix myself, but I prefer to wait for your testcase.
| 
| Coming later tonight, I hope :)

Yay!

-- 
Sidnei da Silva <sidnei at awkly.org>
http://awkly.org - dreamcatching :: making your dreams come true
http://www.enfoldsystems.com
http://plone.org/about/team#dreamcatcher

<TQuid> Jesus shit.  Is there anything twisted doesn't do, or at least doesn't intend to do?
<dash> tquid: XML.



More information about the z3-sqlos mailing list