On 16 May, 16:14, Michael Merickel <[email protected]> wrote: > The way Pyramid thinks about decorators is that when the decorator's > callback is invoked upon scan, the configurator object is passed into > the callback. From there you can do what you need to do via config or > config.registry or config.registry.settings, etc. The simplest way to > setup decorators is to create a new directive on the configurator > which does what you want imperatively. Then just have the decorator > call that. > > For example, @view_config simply calls config.add_view(). This keeps > view_config very focused only on decorator logic and not how to add > views. For direction on writing a decorator like view_config just look > at config.add_directive and the view_config implementation (after > reading how venusian works). Yeah the docs could probably be improved > here. Below are the two links I know of in the docs which should get > you started. > > http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/hoo...http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/ext... > > The @action decorator in pyramid_handlers is different because it is > not found at scan-time. Rather, when you call add_handler(MyHandler), > the class methods are scanned for @action decorators. > > HTH, > Michael
I've looked into Venusian docs before, and 1st of the links you provided is _exactly_ what I need. Wouldn't think to look for it in Hooks chapter of docs, though. Thanks so much for your help. Best regards, Peter -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
