[Zope-dev] serialization with Ape

2003-06-11 Thread Christian Scholz
Hi list! :) I am just playing around with Ape (very cool, btw :) and wondering how it can be used from the outside, e.g. not controlled by transactions. Main idea is to manually copy parts of the ZODB to the filesystem (from a product). I first tried the transaction based process, as I found it

Re: [Zope-dev] serialization with Ape

2003-06-11 Thread Shane Hathaway
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

Re: [Zope-dev] serialization with Ape

2003-06-11 Thread Christian Scholz
Hi! 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

Re: [Zope-dev] serialization with Ape

2003-06-11 Thread Shane Hathaway
Christian Scholz wrote: 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

Re: [Zope-dev] serialization with Ape

2003-06-11 Thread Shane Hathaway
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

[Zope-dev] oh boy [id,getId() madness]

2003-06-11 Thread Romain Slootmaekers
Yo, I have an error in this code fragment: - fragment -- for childObject in container.objectValues(): id=childObject.getId() childObject2=container[id] # sometimes gives a KeyError #... - /fragment -- So it means that there are contained

Re: [Zope-dev] oh boy [id,getId() madness]

2003-06-11 Thread Stefan H. Holek
This is definitely possible. You probably have a faulty factory method. In Zope, construction is a two step process that looks something like def addSomething(self, id, title=''): ob = Something(id, title) self._setObject(id, ob) An ObjectManager must know the ids of its subobjects

Re: [Zope-dev] oh boy [id,getId() madness]

2003-06-11 Thread Chris McDonough
On Wed, 2003-06-11 at 14:13, Romain Slootmaekers wrote: The questions are: - has anyone else experienced this ? Yes... - what could be causing this ? Assigning an object a different id than that passed to its constructor, e.g.: object = anobject(id='id')

Re: [Zope-dev] serialization with Ape

2003-06-11 Thread Christian Scholz
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

Re: [Zope-dev] oh boy [id,getId() madness]

2003-06-11 Thread Adrian van den Dries
On June 11, Stefan H. Holek wrote: This is definitely possible. You probably have a faulty factory method. In Zope, construction is a two step process that looks something like def addSomething(self, id, title=''): ob = Something(id, title) self._setObject(id, ob) That's why