>>> Log message for revision 39807:
>>>   transaction.commit(1) is deprecated in favor of transaction.savepoint().

[Tres Seaver]
>> This likely needs to be 'savepoint(optimistic=True)' (see collector
>> #1860 for rationale).

[Stefan H. Holek]
> Perhaps. However, these tests specifically check interactions between
> persistent objects, their attributes, and transaction commit/abort.
> If things break there, I want to know about it.

The full deprecation msg spells it out in more detail:

    subtransactions are deprecated; instead of  transaction.commit(1), use
    transaction.savepoint(optimistic=True) in contexts where a subtransaction
    abort will never occur, or sp=transaction.savepoint() if later rollback is
    possible and then sp.rollback() instead of transaction.abort(1)

If you're not testing *sub*transaction aborts (you only mention
"transaction abort" above, and that's not the same thing), then
there's no reason to avoid passing optimistic=True.

The only effect _not_ passing True has then is to raise a nuisance
exception if some data manager involved in the transaction doesn't
support the new ISavepoint interface.  But if you're never going to do
a subtransaction abort, then there's no need for any data manager to
support ISavepoint.  That's why optimistic= exists.  If you _are_
going to do a subtransaction abort, then just calling
"transaction.savepoint()" is inadequate:  you would need also to
assign the result of that to a variable, in order to call its
rollback) method later (at the point where you used to do

So, either way, the current code is a bit off target.  Best guess is
that you're not interested in *sub*transaction aborts here, so that
you do want to pass optimistic=True.
Zope-Coders mailing list

Reply via email to