Opened 13 years ago

Closed 13 years ago

#17173 closed New feature (fixed)

Add a unit test for reverse('namespace:name') -> URL with special regexp chars.

Reported by: kaiser.yann@… Owned by: nobody
Component: Uncategorized Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The last test in this patch fails on 1.3.1 but works on HEAD, and I noticed no other test for it.

Summary of the failure (1.3.1):
If the left part of an include contains special chars in regard to re, using the namespace:name form of reverse() will return a URL with the escape characters left in.

AssertionError: '/+%5C$*/included/normal/' != '/%5C+%5C%5C%5C$%5C*/included/normal/'

Attached are two patches: one for SVN HEAD, the other for 1.3.1, if you want to reproduce the failure.

Attachments (2)

specialchar-unittest.patch (9.2 KB ) - added by kaiser.yann@… 13 years ago.
Patch against SVN HEAD. Adds a few unittests for urlpatterns_reverse
specialchar-unittest-1.3.1.patch (8.6 KB ) - added by kaiser.yann@… 13 years ago.
Same for 1.3.1

Download all attachments as: .zip

Change History (3)

by kaiser.yann@…, 13 years ago

Attachment: specialchar-unittest.patch added

Patch against SVN HEAD. Adds a few unittests for urlpatterns_reverse

by kaiser.yann@…, 13 years ago

Same for 1.3.1

comment:1 by Chris Beaven, 13 years ago

Resolution: fixed
Status: newclosed

In [17075]:

Fixes #17173 -- Added some extra regression tests for reversing namespaced urls with special characters

The actual code was already fixed between 1.3.1 and trunk, but more thorough tests are always a good thing. Thanks for the patch, Yann Kaiser.

Note: See TracTickets for help on using tickets.
Back to Top