[ZODB-Dev] Assigning to _p_jar and aborting

Christian Robottom Reis kiko at async.com.br
Sun Feb 29 14:42:48 EST 2004


I ran into something interesting a while back which might be worth
mentioning now that we're dealing with Connection.add()/assignment to
_p_jar. If you assign to an Object's _p_jar and modify it but never
commit(), ISTM you'll run into an exception like this if you try to
abort/sync the transactions:

  File "/mondo/local//lib/python2.3/site-packages/ZODB/Transaction.py", line 134, in abort
    j.abort(o, self)
  File "/mondo/local//lib/python2.3/site-packages/ZODB/Connection.py", line 266, in abort
    assert object._p_oid is not None
AssertionError

The workaround I'm using is to ensure I commit the objects that have _p_jar
assigned to at least once (in my case, it's a reasonable expectation). I
would suggest a fix if I knew what should be done in this case; changing
the assertion to an if/return could be an approach, but might mask other
bugs in unrelated code.

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331



More information about the ZODB-Dev mailing list