Ticket #1862 (closed defect: fixed)
[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
Change History
comment:1 Changed 11 years ago by faide
for more info see discussion here: http://groups.google.com/group/turbogears/browse_thread/thread/3b8fd2778c6af05b
comment:3 Changed 11 years ago by Chris Arndt
What has the linked mailing list post to do with this issue?
comment:4 Changed 11 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).