[ZCM] [ZC] 1937/ 5 Comment "Subtransaction warnings on Zope trunk"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Mon Oct 31 22:37:46 EST 2005


Issue #1937 Update (Comment) "Subtransaction warnings on Zope trunk"
 Status Accepted, Zope/test medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/1937

==============================================================
= Comment - Entry #5 by tseaver on Oct 31, 2005 10:37 pm

*That* was a "what the dog did in the night" moment:  the browser
obviously communicated *something* to Zope about my file, because
it got the same ID as my local filename, but it did not actaully
end up saving the file.

I have re-uploaded it;  indeed, all it does is replace the three
instances of 'transaction.commit(1)' with
'transaction.savepoint(optimistic=True)', which ought to be enough
to make the copy-paste machinery happy.
________________________________________
= Comment - Entry #4 by tim_one on Oct 31, 2005 8:35 pm

Alas, the patch is 0 bytes (i.e., it's empty), so I don't know exactly what you had in mind.  I _bet_ it would be enough to replace the subtxn commit with

import transaction
...
transaction.savepoint(optimistic=True)

If there's no path later that can do a subtransaction _abort_ of the original subtxn commit, then savepoint creation as shown above should accomplish the same thing.
________________________________________
= Assign - Entry #3 by tseaver on Oct 31, 2005 8:30 pm

 Status: Pending => Accepted

 Supporters added: efge


Uploaded:  "collecctor_1937.patch"
 - http://www.zope.org/Collectors/Zope/1937/collecctor_1937.patch/view
The Five code needs to get jars associated with the objects being
copied / pasted, and so relies on a subtransaction.

I'm uploading a patch which makes it the tests pass for Florent
to review, assuming that I have not misunderstood the intent.
________________________________________
= Comment - Entry #2 by tim_one on Oct 31, 2005 6:31 pm

I got rid of the warnings.resetwarnings() calls in Zope's tests, and there are no longer any spurious deprecation warnings from the ZODB/ZEO tests on Zope trunk.

Leaving the Five test to someone else.
________________________________________
= Request - Entry #1 by tim_one on Oct 31, 2005 5:29 pm

Subtransactions are still supported in ZODB 3.6, but are deprecated, and generate deprecation warnings.  Code still using them should change (to use savepoints instead).  Most code has been so changed.

The test in lib/python/Products/Five/tests/event.txt is an exception, and should be fixed.  I don't know how to change Five code.

There are about a dozen deprecation warnings from the ZODB tests.  After a looooong time staring, this is Zope's fault.  The ZODB tests still test subtransactions (because they're still supported), but go to a lot of trouble to install warning filters around such tests so that the deprecation warnings aren't sprayed to the screen.  This works fine in a ZODB checkout, and in a Zope3 checkout.

However, Zope trunk has two test files:

    lib/python/AccessControl/tests/testDeprecatedAPI.py

and

    lib/python/Zope2/Startup/tests/test_warnfilter.py

that contain the extremely antisocial

    warnings.resetwarnings()

Any instance of that wipes out all the warning filters the ZODB tests set up, so we get a bunch of nuisance complaints only when running the ZODB tests as part of the Zope trunk tests.

Those files should be changed to stop calling resetwarnings().  There is, alas, no other official way of removing a warning filter, but

    del warnings.filters[0]

is a common unofficial way to remove the last warning filter added.
==============================================================



More information about the Zope-Collector-Monitor mailing list