Shall I submit this as a patch or am I missing something?
-- Chris
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
I know, but my thought was that the path is so universally important
that it should be really among the "standard" vars.
I don't think all users are aware that 1) the path is available via
charrypy.request.path and 2) you can supplement the standard vars. They
may think they have to pass the page manually or add special decorators:
http://www.mail-archive.com/turbo...@googlegroups.com/msg25527.html
So I think it makes sense to have the request path (and the template
path) available in the template by default already.
-- Chris
Yes, but having it there by default is a big win... ;-)
--
Jorge Godoy <jgo...@gmail.com>
Sounds reasonable, mind anyone opening a "patched" ticket at the
Trac? :)
Thanks,
Alberto
> Sounds reasonable, mind anyone opening a "patched" ticket at the
> Trac? :)
I've been thinking... What about making tg.request (cherrypy.request)
available? There we'd have all information from the request and we
could modify it there... Of course, a complement of turbogears.request
would also be nice.
AND, since we're going towards WSGI, we can make that an entry_point or
a configuration parameter... By default this would be cherrypy.request,
but it could be any request object.
What do you think?
--
Jorge Godoy <jgo...@gmail.com>
On 17 abr, 00:31, Jorge Godoy <jgo...@gmail.com> wrote:
Fine with me too, however, making it configurable via an entry point
seems an overkill to me and overlaps with what extensions provide.
Keep in mind extensions are also loaded via entrypoints and these have
the ability of adding new variables to the template namesace.
So, to sum up, I'm +1 on putting request on tg.request but -1 on
creating a new entry-point to configure which object is bound here.
Alberto
-- Chris