[Zope-PTK] Hooks

Shane Hathaway shane@digicool.com
Fri, 18 Aug 2000 12:58:08 -0400


Fabio Forno wrote:
> 
> 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()

Okay, I think what we'll do is create versions of the tools that
provide hooks in the right places.  It would be beneficial if you would
list for us the hooks we ought to provide (such as
WorkflowTool.beforeChangeState(), WorkflowTool.afterChangeState(),
etc.)

Shane