Another approach would be to have in-memory copies of the objects in  the
zodb (they could even be the same class, just without a database
connection).  Saving the file pushes the copy's data to the ZODB and
commits a transaction.  This would work with a single long running
connection or with short connections, opened just for save and load.


Many thanks for this reply.  Using copies of zodb objects should be
straightforward. Having only one short-lived connection open at a time would
probably keep things simplest.

I think the reverting use case needs a mechanism other than ZODB undo.

If at most one connection is ever open, a Leo-revert is just a pull from the
zodb, something like:

# Exception-handling omitted...
connection = db.open()
v = connection.root().get(fileName)
v2 = c.zodbTreeToLeoTree(v)
get_transaction().commit()
connection.close()
c.setRootVnode(v2)
c.redraw()

Edward
--------------------------------------------------------------------
Edward K. Ream   email:  [EMAIL PROTECTED]
Leo: http://webpages.charter.net/edreamleo/front.html
--------------------------------------------------------------------


_______________________________________________
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