Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #2437 (closed defect: fixed)

Opened 10 years ago

Last modified 9 years ago

tg.url() docstring does not match behavior, pagination problem

Reported by: chrisz Owned by:
Priority: high Milestone: 2.1b2
Component: TurboGears Version: 2.1a3
Severity: normal Keywords: tg.url pagination


Just noticed that the docstring of the tg.url() function does not match with the actual behavior any more in TG 2.1.

The docstring says "For backwards compatibility you can also pass in a params dictionary which is turned into url params, ..."

However, it's the other way round now, kwargs are supported for backward compatibility only (with a deprecation warning), and only passing a dict in params seems to be supported in the future. (Is this really what we want?)

Second, the docstring says "In general `tg.url is just a proxy for pylons.url which is in turn a proxy for routes url_for function."

However, tg.url does not seem to resort to pylons.url any more.

I'd like to fix that docstring, but I'm not sure whether these changes are intentional or not.

Remark made by Jonathan on tg-trunk: This also seems to have broken the pagination system (when you show the pagination links, it throws an error 500).

See also #2272 and #2371 for other issues with tg.url().

Change History

comment:1 Changed 9 years ago by chrisz

I'm also getting these deprecation warnings in quickstarted apps:

DeprecationWarning: Passing in keyword arguments as url components is deprecated.

comment:2 Changed 9 years ago by chrisz

For the pagination problem, see also #2455.

comment:3 Changed 9 years ago by mramm

  • Milestone changed from 2.1 to 2.1b2

comment:4 Changed 9 years ago by percious

  • Status changed from new to closed
  • Resolution set to fixed

comment:5 Changed 9 years ago by chrisz

Thanks. For the records and better traceability of fixes you should also link to the changeset of your fixes (in this case,  c345086f9280 and  78d3869f7deb).

Also, I'm missing a motivation why passing keyword parameters was discarded, since I think it was a handy and intuitive feature. I'm sure there is a reason, but I currently don't see it.

Note: See TracTickets for help on using tickets.