[Zope-dev] serialization with Ape

Christian Scholz cs@comlounge.net
Wed, 11 Jun 2003 22:38:55 +0200


Hi again!

> Christian Scholz wrote:
> >     root_mapper, conns = createMapper(fspath)
> >     ei=ExportImport(root_mapper,conns)
> >     ei.exportObject(object)
> 
> Ah-ha, I just realized what went wrong.  You need to tell exportObject() 
> where to export.  PathKeychainGenerator refused to guess.  Try changing 
> the last line to:
> 
>      ei.exportObject(object, keychain=('some/path/under/fspath',))

I now tested it and had the following results:

- the last item of the path needs to be the same id as the object has
- only objects derived from Objectmanager in the end can be serialized.
- they are not written to disk as long as I don't do

    conns['fs'].vote()
    conns['fs'].finish()

After that it worked quite well :)

I now did the import the other way round with

obj=ei.importObject(keychain)

and then using _setObject with that object in order to store it again
in the usual ZODB (Data.fs). Is this ok? Or do I again need to do some copy?

> It's still obtuse.  I'll think about how to make that cleaner.

Well, for me the whole thing actually is magic. But maybe it helps
if there is an example of usage in the docstring. 

But it seems working now, so fine :-)

Thanks again!

Christian

-- 
COM.lounge                                          http://comlounge.net/
communication & design                                 info@comlounge.net