[Zope-dev] serialization with Ape

Shane Hathaway shane@zope.com
Wed, 11 Jun 2003 10:12:46 -0400


Christian Scholz wrote:
> I then detected the fascades in io.py which I tried to use (dunno if they're
> thought to be used for such a purpose actually ;-):
> 
>     root_mapper, conns = createMapper(fspath)
>     ei=ExportImport(root_mapper,conns)
>     ei.exportObject(object)

This is *exactly* the purpose ExportImport is meant for, but it's quite 
new and unfinished.  I'm glad you found it, although it's only in CVS, 
not in the released version of Ape.

> Unfortunately this results in an exception 
> 
>     Type: MappingError
>     Error Value: Path keychains require a name
> 
> So can maybe somebody point me to the easiest way to serialize an object
> using the fsmapper (Shane? ;-) ?

You're on the right track.  I wonder what went wrong.

> I am also interested in reading a serialized object from the fs again
> and writing it to the fs. Also I wonder if I need to delete objects which
> have been modified before another export or if there's a possibility to
> just change it).

Ape will assign new OIDs on import, so you don't have to delete objects 
first.

> (and the best would be of course some simple methods for reading/writing
> a whole directory recursively. I don't know if something like this is already
> in there somehow or how it works internally.. seems all a bit magic to me ;-)

Again, ExportImport is designed to do this.

Shane