[Zope-PTK] Hooks

Fabio Forno sciasbat@inorbit.com
Fri, 18 Aug 2000 18:07:31 +0200


Fabio Forno wrote:

> yeah, this was my idea: if you leave in the tool class an empty method
> which is an hook, when you add a method with the same name to its
> instance, you should override it, isn' it?  This could be a good way to
> quickly add functionality to a portal object without having to  worry a
> lot of the low level changes.
> 

I doesn't work, but there is a bypass. I've derived the WorkflowTool
class from PortalObjectBase, so I could be able to add a python method
within the Zope management interface. In this way it's impossible to
override a hook method, but it's possible to call it in this way,
without any subclassing:

if hasattr(self,'hook_function'): 
  self.hook_function()


ByE,
FF