This is a repost of my original: Can Leo use zodb as a file system.
Both the title of the thread and the botched formatting may have put people
off, so let's try again :-)

All you really need to know about Leo is an editor that represents programs
as outlines. For full details, see:

Several of Leo's users have suggested that Leo could use the zodb instead of
reading and writing files.  I hope a zodb guru can help me determine whether
this project is feasible. I have spent several days writing simple prototype

I'll try to make this post as short as possible, but some background is
needed. I'll attempt to make my assumptions explicit so they can be
corrected as needed...

The idea is to represent a Leo outline as an entry in the zodb.  To write
the data Leo would do:

   connection =
   root = connection.root()
   root[fileName] = v

v is the root of a tree of Leo's vnodes and tnodes. (vnodes and tnodes
contain all of Leo's persistent data, and vnodes and tnode both derive from

Similarly, to open a new Leo outline:

   v = root.get(fileName)
   c2 = # Create a new outline, whose 'commander' is c2.
   c2.setRootVnode(v) # Tell the commander the root of the outline is v.

I want to know if this scheme can be used if there are multiple Leo outlines
open. In my (zodb newbie's) mind this question translates to the following
zodb-specific questions:

1. Is it possible associate a particular connection with a particular Leo

2. Is it possible to **leave a connection open** for as long as a particular
Leo outline is open?

3. If multiple Leo outlines  (and multiple connections) are open, is it
possible to define transactions that are specific to particular connection?
In particular, does something like connection.commit() exist, and if so, how
are connection-specific transactions defined?

The reason I ask these particular questions is this:  If my prototype opened
an outline as above and then *closed* the connection, my prototype threw
this exception soon after I started to use the outline:

Traceback (most recent call last):

 File "C:\prog\tigris-cvs\leo\src\", line 5010, in getScript
   elif p == c.currentPosition():
 File "C:\prog\tigris-cvs\leo\src\", line 1370, in __cmp__
   if p1.childIndex() != p2.childIndex():
 File "C:\prog\tigris-cvs\leo\src\", line 1580, in childIndex
   if not v or not v._back:
 File "C:\Python24\Lib\site-packages\ZODB\", line 587, in
   raise RuntimeError(msg)
RuntimeError: Shouldn't load state for 0x60af when the connection is closed

Here p is an instance of a Leo position, a short-lived object that *refers*
to vnodes and tnodes but is *not* itself persistent.

So is it possible for non-persistent objects to refer to persistent objects?


1. It appears that zodb does not update persistent objects properly when the
connection that created those objects is closed.  I say this because of the
traceback given above.  Thus, I assume that *long-lasting* connections are
required to support persistent objects.  Is this assumption correct?

2. With multiple Leo outlines connected to multiple connections there must
be some way to **save one outline without saving them all**.
(or to revert one outline without reverting them all.)  How do I define
outline-specific transactions?

Thanks for your help.

Edward K. Ream   email:  [EMAIL PROTECTED]

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -

Reply via email to