Opened 4 years ago

Closed 4 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: master
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation:
Needs tests: Patch needs improvement:
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@… 4 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@… 4 years ago.
Same for 1.3.1

Download all attachments as: .zip

Change History (3)

Changed 4 years ago by kaiser.yann@…

Patch against SVN HEAD. Adds a few unittests for urlpatterns_reverse

Changed 4 years ago by kaiser.yann@…

Same for 1.3.1

comment:1 Changed 4 years ago by SmileyChris

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

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