[Zope] Monkey patching and inheritance
Dennis Allison
allison at sumeru.stanford.EDU
Wed Jan 14 17:47:12 EST 2004
I am using monkey patches to modify Zope.
I modify UserFolder.py by providing replacements for a number
of methods. These methods are simply defined in an __init__.py
in a module in the product folder, MyUserFolder.
The UserFolder class is imported, the new overriding methods defined, and,
at the end, InitializeClass is imported from Globals, and the patched
procedure names assigned to their correspondiong names in Userfolder
namespace, and InitializeClass() called on the UserFolder.
The new code is fairly cautious about persistence. Use is made of
PersistentMapping and PersistentList for mutable structures.
I've been having occasional crashes of the Zope system with a
diagnostic
AttributeError: Surrogate instance has no attribute '_p_oid'
which I have finally traced to the UserFolder modifications!
Apparently I have somehow broken the persistence mechanism
in my monkeypatching.
Advise on what the problem might be and how to repair it would be very
helpful.
-dra
More information about the Zope
mailing list