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 #1862 (closed defect: fixed)

Opened 9 years ago

Last modified 9 years ago

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

Reported by: wmark Owned by: 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 Download (821 bytes) - added by wmark 9 years ago.

Change History

Changed 9 years ago by wmark

comment:2 Changed 9 years ago by faide

  • Version changed from 1.0.4.4 to 1.0.5

comment:3 Changed 9 years ago by Chris Arndt

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

comment:4 Changed 9 years ago 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).

Note: See TracTickets for help on using tickets.