[ZODB-Dev] Webkit Threading and ZODB 3.3a2: problems on Windows
Christian Robottom Reis
kiko at async.com.br
Thu Feb 19 17:38:36 EST 2004
On Thu, Feb 19, 2004 at 05:25:43PM -0500, Jeremy Hylton wrote:
> > 4. If changes ARE made, we do call get_transaction().commit()
> > 5. Before the servlet "shuts down" we assign the references to the
> > object, to the root, to the connection all to None (but we do NOT
> > delattr() them...)
>
> You should actually close the connection -- call the close() method.
>
> Just before you close the connection, add some variant of this code
>
> assert not get_transaction()._objects
>
> The _objects attribute stores all the objects registered with the
> transaction. If you haven't modified anything, the list will be empty.
> If you have modified something, the assertion will fail.
A note that may come in handy, which is an exception to what Jeremy
states above: when a subtransaction is committed, this list is emptied
(see Transaction.py:commit for details), so if you are using
subtransactions, that can trick you into thinking nothing was changed,
when in fact it was commit(1)-ed away.
I don't know how to check for objects modified and commit(1)-ed, but I
suspect there is a [potentially non-trivial] way.
Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331
More information about the ZODB-Dev
mailing list