Ticket #1862 (closed defect: fixed)

Opened 2 months ago

Last modified 1 week ago

[Patch] correct formatting of URLs by tg.url if parameters are already present

Reported by: wmark Assigned to: anonymous
Priority: normal Milestone: 1.0.x bugfix
Component: TurboGears Version: 1.0.5
Severity: normal Keywords:
Cc:

Description

Invoking tg.url twice on a URL results in a malformed URL in the sense of containing the wrong parameter delimiter. Reproduce by:

addr = tg.url('/path', {'first': 1})
addr = tg.url(addr, {'second': 2})
print addr

Result is: /path?first=1?second=2
Should be: /path?first=1&second=2

A patch to fix this issue is attached. This bug does not exist in TG2 due to #1649

Attachments

tg-1.0-url_encoding.patch (0.8 kB) - added by wmark on 06/17/08 04:16:14.

Change History

06/17/08 04:16:14 changed by wmark

  • attachment tg-1.0-url_encoding.patch added.

07/04/08 15:22:17 changed by faide

07/04/08 15:22:27 changed by faide

  • version changed from 1.0.4.4 to 1.0.5.

08/21/08 20:11:35 changed by Chris Arndt

What has the linked mailing list post to do with this issue?

08/21/08 21:11:17 changed by Chris Arndt

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

Though it is questionable if the given example is a correct usage pattern, one might still apply url() to a URL that already has a query string.

The supplied patch breaks if any of the given params has a list value because it uses a dict to collect them.

Applied corrected version with test in r5191 (1.0) and r5193 (1.1).