Issue #548 resolved

[PATCH] Rename the before_main hook to before_handler and MainTool to HandlerTool

created an issue

As discussed some times ago with fumanchu via email this little change does make much more sense IMHO and makes the hook more intuitive.

As you can see directly from the source code:


!python'before_handler') if self.handler: self.handler()'before_finalize') }}}

I also renamed MainTool to HandlerTool since this is what it does, while doing this I was wondering if it could make sense to override the call method of the Tool class inside HandlerTool to do what the handler method does now, so instead of doing this:



class Root: nav = tools.staticdir.handler(section="/nav", dir="nav", root=absDir) }}}

you could do:



class Root: nav = tools.staticdir(section="/nav", dir="nav", root=absDir) }}}

This is only an idea that doesn't make much sense most probably, fumanchu do you expect an HandlerTool to be used as a decorator also? in this case it is worth keeping things as they are, I'm sure there is a good reason you made it that way that's why my patch doesn't change this aspect. ;-)

Comments (5)

  1. michele reporter

    This patch should probably be update to the latest revision.

    I think it's worth renaming before_main to before_handler and MainTool to HandlerTool (since it also provides an handler method) before the first CP3 beta.

  2. Log in to comment