Jim Penny <[EMAIL PROTECTED]> wrote:
> Is there a safe way to handle multiple monkeypatches?
Without an existing framework (I haven't looked at Adrian's PatchKit),
it's the same old problem as "intercepting interrupts" on good old 8-bit
computers. You just have to save and call the previous one.
What I do is this:
# 1. define my method
def manage_main(...):
# ...
...
res = self._myproduct_old_manage_main(...)
...
return res
# 2. put the old version in a private variable
ObjectManager._myproduct_old_manage_main = ObjectManager.manage_main
# 3. patch
ObjectManager.manage_main = manage_main
If you want to play nice with refresh, you have to be a bit more
careful, because then you don't want to do step 2. A simple test for
absence of the _myproduct_old_manage_main attribute before doing it is
enough.
Florent
--
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87 http://nuxeo.com mailto:[EMAIL PROTECTED]
_______________________________________________
Zope-Dev maillist - [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope )