[Zope] HotFixing methods of modules (not classes)

Peter Bengtsson mail@peterbe.com
Mon, 16 Jul 2001 18:05:25 +0200


We tried that, but it doesn't work either.

I see no pythonic reason why it should be any different for functions.
Perhaps it's got something to do with the way Zope imports its modules.

Still troubled.

Peter

> > 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
> `------------------>