From: "Alec Mitchell" <apm13@columbia.edu>
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): pass
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)?
How about simple acquisition? eg Folder A | | --Method AAA | --Folder B | |-- Method AAA Method AAA in Folder B will be found by acquisition before Method AAA in Folder A (assuming you set up the path that way). Jonathan