Hi, Antonia... first of all: please don't hijack threads. Start a new thread if you want to post to this list. Don't just reply to a random posting.
On Mittwoch, 28. Mai 2008, Antonio Beamud Montero wrote:
> How I can get the controller name in the actual template context. For
> example, a site.mako template used by several controllers, I want to
> show the controller name with something like this:
>
> ${c.name}
>
> It's possible or I must define a property for every controller with it's
> name?
The routes dictionary contains the information you are after:
request.environ['pylons.routes_dict']
You cann add a "def __before__(self)" in the lib/base.py and fill a
template variable with it to be used in the templates:
c.routes = request.environ['pylons.routes_dict']
That would allows you to access the current controller's name in the
template as:
${c.routes['controller']}
Cheers
Christoph
signature.asc
Description: This is a digitally signed message part.
