Re: [ZODB-Dev] zodb pickle format for root

2006-01-20 Thread Jim Fulton

Florent Guillaume wrote:
In storage.py there's a comment saying that only a few types of  pickles 
for the class descriptions are written, even if more are read.
But actually in DB.py there's this code that creates a new root if  oid 
z64 doesn't exist:


root = PersistentMapping()
...
p.dump((root.__class__, None))
p.dump(root.__getstate__())

This is actually format #5 and according to serialize.py it's not  used 
anymore for writing. I guess the root is an exception.


I haven't checked if just justing p.dump(root.__class__) works but it  
should.


This is just a fossil.  Feel free to change it if you wish.
Or to add an entry to the ZODB collector.

Jim

--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org
___
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


RE: [ZODB-Dev] zodb pickle format for root

2006-01-20 Thread Tim Peters
[Florent Guillaume]
 In storage.py there's a comment saying that only a few types of pickles
 for the class descriptions are written, even if more are read. But
 actually in DB.py there's this code that creates a new root if oid z64
 doesn't exist:

  root = PersistentMapping()
  ...
  p.dump((root.__class__, None))
  p.dump(root.__getstate__())

 This is actually format #5 and according to serialize.py it's not used
 anymore for writing. I guess the root is an exception.

 I haven't checked if just justing p.dump(root.__class__) works but it
 should.

I agree with Jim:  change it.  I expect that keeping this served a purpose
long ago, to make sure that databases written by a then-new ZODB could still
be read by an older ZODB.  That's the same reason we keep the (objectively
idiotic) distinction between PersistentDict and PersistentMapping (which
are conceptually identical, although their implementations keep getting out
of synch :-( -- PersistentDict should go away).

___
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