#2194: Turbogears overrides controller return values for templates
------------------------+---------------------------------------------------
Reporter: kikidonk | Owner: faide
Type: defect | Status: new
Priority: normal | Milestone: 2.0b6
Component: TurboGears | Version: trunk
Severity: normal | Keywords:
------------------------+---------------------------------------------------
Because of http://trac.turbogears.org/browser/trunk/tg/render.py#L125
If a controller returns any value which name collides with one of the
builting template variable defined in _get_tg_vars, that value will be
overwritten and confusion will ensue.
For example if a controller returns
{{{
@expose('foobar.html')
def foo(self):
return {'url': 'http://www.turbogears.org}
}}}
An attempt to use {{{${url}}}} in the foobar template will result in
{{{tg.controllers.url}}} being returned.
I guess the fix would be to prefer user-returned values over default
tg_vars, instead of {{{template_vars.update(_get_tg_vars())}}} maybe use
something like {{{final_vars = _get_tg_vars();
final_vars.update(template_vars)}}}
--
Ticket URL: <http://trac.turbogears.org/ticket/2194>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---