[ZODB-Dev] strange savepoint behavior

Dieter Maurer dieter at handshake.de
Sun Nov 6 04:03:28 EST 2005


Tim Peters wrote at 2005-11-3 12:31 -0500:
> ...
>But those details are all artifacts of exactly how your test case is
>written.  As a general rule, if you do a rollback _beyond_ the creation of a
>new persistent object P, you shouldn't expect P to be in a useful state
>anymore (and, as you've seen, the rollback will destroy P's state if the
>transaction machinery knows about P at the time the rollback is done -- and
>if P came into existence after the savepoint to which the rollback was done,
>there's no record remaining anywhere of what P's state was before the
>rollback).

As usual, an excellent explanation...

However, it implies that "savepoint" and "rollback" do not work
as a naive user might expect. I, myself, would have been surprised
that "rollback" can do a third thing ("empty it") to an object other than
restore its state or leave it untouched.
Thus, probably a warning note is appropriate in the standard documentation
for the savepoint feature.

Also, you might have mentioned the "add" method to explicitely
inform the connection about new objects that should be managed
by the connection.

-- 
Dieter


More information about the ZODB-Dev mailing list