I actually now have a (as it seems) working version of my first
approach, just using _setObject() etc. which even works recursively.
Has this some drawbacks except it looks a bit like a hack due to the
call of commit()?
I also have the deserialization working and basically it's just a copying between two ZODBs I'd say.
This will work if you duplicate the objects first. apelib.zodb3.utils has a copyOf() function that reliably duplicates ZODB objects.
Doing it this way uses the whole ZODB machinery to import/export. There's nothing wrong with that other than it being a lot of extra work.
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 looked into that a bit and in core/io.py line 316 you do
return kgen.makeKeychain(event, None, 1)
so name is None here as it seems. I just dunno if it's a special case because I was doing something wrong or not ;-)
It's intentional, but perhaps it needs to explain itself better. It's trying to figure out what OID to assign an object and there isn't enough information available.
(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.
Will it also do it recursively? I found out that when I do it via folder._setObject() it will also serialize all content which is quite nice :)
Yes, it's recursive.
What is actually the result of an export? Where in the fs is it stored then? Is the whole path to the object in ZODB is taken ?
I don't know where it would try to export--I haven't thought about that yet. ;-)
But thanks for the answer and thanks for Ape! :)
You're welcome!
Shane
_______________________________________________
Zope-Dev maillist - [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )