Am 24.06.2010 um 16:46 schrieb bloeper:
Hi all,
Sorry for a undoubtedly stupid/simple question.
But I want to create a menu app, so I have a model with the stuff the
menu contains (name, url, etc).
Now I want to create a functions that gets always called regardless of
the page requested...
So i can use a template function to include that in the master
template.
There are several ways to accomplish this. You could
- create your own middleware, which will get called on each request
then. It must reside under the transaction middleware though. To add a
new middleware, either use <project>/config/middleware.py, or overload
some of the methods in <project>/config/app_cfg.py.
- add the call to your BaseController, maybe even in the __before__
or __after__ hooks than one can define on a controller.
- add the call to the master-template all your pages, to render the
menu.
The latter is my personal preference, as it keeps the logic closest to
the spot where it is needed.
Diez
--
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en.