[Zope3-Users] Cannot Pickle

Marc Rijken marc at rijken.org
Wed Mar 9 05:27:37 EST 2005

Jim Fulton wrote:
> Marc Rijken wrote:


> I just tried this code, after adding the missing imports, and didn't get
> an error, so, obviously, you aren't giving us the whole story. :)

Hi Jim,

Posting the complete code, is too long. So I made an abstract summary. I 
  have made a less abstract summary:

from persistent import Persistent
from zope.app.container.btree import BTreeContainer
from zope.app.container.contained import Contained

class TopicMapObject(Persistent):

class TopicMap(BTreeContainer, TopicMapObject):
    def createTopic(self, name):
        self[name] = Topic()

class Topic(TopicMapObject, Contained):

tm = TopicMap()
tm['t2'].type = tm['t1']

This code performs well if I execute it not as part of a zope3 instance. 
When I put it in a zope3 instance, when tm is put in a ZODB folder and 
when the steps are performed in separate sessions I get the Cannot 
Pickle error at the last step. I hope this extra info will help you to 
help me.

(I have an alternative solution by putting the name of the topic in the 
type, so a string will be pickled. But the other solution is my prefered 
one and I hope that that will work too.)



More information about the Zope3-users mailing list