Google Groups Home
Help | Sign in
Message from discussion Adding request path to the stdvars
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Alberto Valverde  
View profile
 More options Apr 16 2007, 4:58 pm
From: Alberto Valverde <albe...@toscat.net>
Date: Mon, 16 Apr 2007 22:58:49 +0200
Local: Mon, Apr 16 2007 4:58 pm
Subject: Re: [tg-trunk] Adding request path to the stdvars

On Apr 16, 2007, at 10:23 PM, Christoph Zwerschke wrote:

> I wonder why the current request path is not available as a global
> template variable (e.g. as tg.path = cherrypy.request.path). I think
> that would be very handy for displaying navigation, breadcrumbs, menus
> etc. in the template. And instead setting a flag in the controller  
> it is
> often easier to check the path directly.

> Shall I submit this as a patch or am I missing something?

You can add whatever variables your app needs to the template  
namespae by appending a function to view.variable_providers

def my_vars(d):
        d['path'] = cherrypy.request.path

from turbogears import view
view.varibale_providers.append(my_vars)

Alberto


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google