home / django_tickets / tickets

tickets: 8287

This data as json

id created changetime last_pulled_from_trac stage status component type severity version resolution summary description owner reporter keywords easy has_patch needs_better_patch needs_tests needs_docs ui_ux
8287 2008-08-13 15:11:58 2011-09-28 16:12:17 2022-03-06 03:41:51.303091 Accepted closed HTTP handling     dev fixed Debug page shows wrong URL info when altering request.path Not sure if this is a bug or an expected behavior, but anyway... I have a middleware that alters {{{request.path}}} in order to hide a certain part of the URL to the views, so if I have an URL like {{{/en/view/page/}}} this should become {{{/view/page/}}}. With recent upgrades this stopped working, and after a bit of investigating I found that this was due to [8015]. I spent a lot of time trying to understand why this was failing, since the debug page was showing the output I was expecting. For example, for {{{/en/view/page}}} I got: {{{ Using the URLconf defined in project.urls, Django tried these URL patterns, in this order: ... 3. ^view/(?P<title_slug>[\w-]+)/$ ... The current URL, view/page/, didn't match any of these. }}} While {{{view/page/}}} ''matches'' the 3rd url pattern. This happens because the debug page shows {{{request.path}}}, while the URLconf actually evaluates {{{PATH_INFO}}} and {{{SCRIPT_NAME}}}. I fixed the problem by altering {{{request.path_info}}} as well, but shouldn't the debug page show the URL that is actually evaluated by URLconf? In case this should be fixed I can provide a patch, but actually I don't know if {{{.path_info}}} should be ''always'' shown or must be shown only in certain places within the debug page. nobody kratorius request.path, urlconf, urls 0 1 0 0 0 0
Powered by Datasette · Queries took 2.467ms