[ZODB-Dev] Help: ZODB undo problem

Christian Reis kiko@async.com.br
Tue, 18 Jun 2002 21:58:06 -0300


On Tue, Jun 18, 2002 at 06:57:18PM -0400, Mike C. Fletcher wrote:
> I'm trying to add undo functionality to a ZODB-3-based single-user GUI 
> application.  I can get the app to undo as long as no window has a 
> pointer to an object in the database.  When a window does have a 
> pointer, the ZODB complains that there is a serial-number mismatch as 
> soon as the window with the old pointer tries to commit.  I would love 

Hmmm, I've never seen this happen with me before, but I guess it could.

> 	1) How to get the "live" objects to update to their previous state when I 
> do an undo (very much preferable, as it would save a lot of re-writing)

get_connection().sync() IIRC - have you tried it?

> 	3) Why the live objects don't automatically update (I thought this was 
> magically done by the ZODB Persistence machinery through the magic of 
> the jar and cache structures).

Well, you have to call connection.sync() to do this manually. It was
decided (IIRC) that updating all the objects automatically wouldn't be
the Right Thing (tm) to do since it would break all the references the
application held locally; it could elect to update them when it wanted.

> I'd be really happy to have an answer for any of the three, or even a 
> pointer to who might be able to answer the question.  This bug has been 
> bugging me for weeks (months?) now, and I really need the undo 

Well, we do undo in Stoq, using the ZODB, so I don't think it should be
a problem. All you do is roll the transaction back and re-show the
object.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL