ZODB "cannot create 'function' instances"

Harry George hgg9140 at seanet.com
Sat Nov 9 20:11:12 EST 2002


I'm just starting with ZODB:

------------
Problem
------------
class Base(Persistent):
   def __init__(self):
       self.id=mkid()  # e.g., '_001'
       ....

class MyClass(Base):
   def __init__(self):
       Base.__init__(self)
       .... (has some dicts and lists)


x=MyClass()

userdb[x.id]=x
get_transaction().commit()

Fails in copy_reg._reduce: "state = base(self)" with
TypeError: cannot create 'function' instances

-------------
Questions
-------------
What function does it think I'm creating?

Do I need to make all dicts and lists Persistent?
Isn't it adequate to commit when they are loaded (and thus
not care about dirty flags)?

Is there a working example of something like this pattern?



-- 
Harry George
hgg9140 at seanet.com



More information about the Python-list mailing list