Prefix use in reversing urls

42 views
Skip to first unread message

Bas Peschier

unread,
Mar 8, 2015, 9:12:07 AM3/8/15
to django-d...@googlegroups.com
Hi all,

currently the reversing mechanism for urls accepts a prefix-kwarg [1], which is not documented [2].

It seems like this prefix is used to prefix the entire generated url and make script_name possible, to which it defaults. It is not used in the entire code base except for tests which can directly test prefixes without going through set_script_name. So in basis: prefix is whatever get_script_name gives you.

What is curious about how Django handles it, is that it treats the prefix as possibly containing regular expressions [3]. Is there any history or documentation that this can be anything other than a valid path?

Removing that mechanism (it simplifies escaping the prefix, which was the original problem in #24013 [4] and a whole chain of previous tickets) unearths tests that don't actually test the correct thing, but overall it runs fine™. Since escaping the reversed url is sensitive security-wise, I would like a couple of eyes on it.


Bas

Reply all
Reply to author
Forward
0 new messages