[Zope] HotFixing methods of modules (not classes)

Casey Duncan cduncan@kaivo.com
Mon, 16 Jul 2001 09:31:37 -0600


Peter Bengtsson wrote:
> 
> I read and used this http://www.zope.org/Members/Caseman/Dynamic_Hotfix
> 
[snip]
> 
> But it is this that I can't get to work. Here I need help:
> 
> ---- buggyhotfix: __init__.py --------------
> # import function
> from module import manage_addSomething
> 
> def myown(self,id):
>      id = string.upper(id)
>      self._setObject(id,Something(id))
> 
> module.manage_addSomething = myown
> --------------------------------------
> 
> it's the "module.manage_addSomething = myown" part that looks like the evil
> thing.
> 
> Any hints?
> 
> Cheers,
> Peter

What if you import the whole module instead of just the one function? as
in:

-------------------------
import module

def myfunc():
    ...

module.theirfunc = myfunc
-------------------------

hth,
-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>