Ticket #2449 (reopened defect)

Opened 2 months ago

Last modified 2 months ago

Template Namespace and `url`

Reported by: rpetrello Assigned to:
Priority: normal Milestone: __unclassified__
Component: TurboGears Version: 2.1a3
Severity: normal Keywords:
Cc:

Description

I've just noticed this in TG2.1a3, verified in a recent quickstarted project:

It seems that any @exposed() controller that uses the key url in its namespace, e.g.:

    @expose('genshibug.templates.index')
    def index(self):
        """Handle the front-page."""
        return dict(page='index', url='http://google.com')

...the value for url is always overwritten w/ <routes.util.URLGenerator object at 0x10422c8d0>. Is this expected behavior? Maybe some form of misconfiguration?

Change History

01/29/10 14:05:46 changed by percious

  • status changed from new to closed.
  • resolution set to wontfix.

yes, this is expected behavior because pylons writes the url function into the namespace before rendering the template. We cannot change the way this functions because it will break API for many people.

01/30/10 14:01:47 changed by mramm

  • status changed from closed to reopened.
  • resolution deleted.
  • severity changed from minor to normal.

This is not done by pylons, it's done in the tg rendering code, and it seems like it's the reverse of what *should* be happening.

The standard variables should be overwritten by the ones that come from the user's return dictionary, not the other way round.

I think this is a very small fix.