On May 12, 2007, at 1:00 PM, Paul Winkler wrote:

On Sat, May 12, 2007 at 10:44:34AM -0400, Jim Fulton wrote:

I've releases ZODB 3.8.0a1 tp PyPI:

  http://www.python.org/pypi/ZODB3/3.8.0a1

To see what's in 3.8.0, see the news file:

  http://svn.zope.org/ZODB/trunk/NEWS.txt?rev=75692&view=auto

This also includes the recent storage API standardization's, removal
of subtransactions, and deprecation of versions.  I should have
included that in the NEWS  file.  I'll fix that for the next release.

I belatedly realized I have some old test code that uses a
"subtransaction hack" to get a _p_jar and _p_oid:

        try:
            transaction.commit(1)
            # do something needing _p_jar or _p_oid
        finally:
            transaction.abort(1)

What's the correct thing to do now?

You can create a savepoint or you can use the connection add method to give a new object a _p_jar and _p_oid before a commit. (There are cases where the object of interest isn't handy and using a savepoint if more convenient.)

Are savepoints relevant for this
(ab)use?

Yes

I don't think this idiom was ever formally documented, it
was just an informal hack that I picked up somewhere (I forget from
whom).

I've used this trick with savepoints.

Jim

--
Jim Fulton                      mailto:[EMAIL PROTECTED]                Python 
Powered!
CTO                             (540) 361-1714                  
http://www.python.org
Zope Corporation        http://www.zope.com             http://www.zope.org



_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to