[Zope] Override a method of an instance in the ZODB?

Alec Mitchell apm13 at columbia.edu
Thu May 27 16:11:20 EDT 2004

Hello zope gurus,

I'm wondering if it is possible to override a method on a single instance of 
an object in the ZODB.  My suspicion is no, but it doesn't hurt to ask.  
Specifically, I've tried:

def userFolderDelUsers(self, names):

from types import MethodType
setattr(acl_users, 'userFolderDelUsers', MethodType(userFolderDelUsers, 
acl_users, acl_users.__class__))

Which works fine until the transaction gets committed, at which point it fails 
with "TypeError: can't pickle function objects".  Which seems pretty much 
like a lost cause.  Can you only do this at the class level?  Is there an 
unrelated way to accomplish the same goal (overriding a method, without 
monkeypatching or subclassing)?

Thanks for any enlightenment,
Alec Mitchell

More information about the Zope mailing list