Opened 8 years ago

Closed 8 years ago

#21579 closed Bug (fixed)

i18n_patterns redirect not working with script prefix (sub path)

Reported by: buettgenbach@… Owned by: nobody
Component: Core (URLs) Version: dev
Severity: Normal Keywords: i18n_patterns SCRIPT_NAME i18n prefix
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Assume the following url pattern:

urlpatterns += i18n_patterns('',
    url(r'^imprint/$', view, name='imprint'),

"en" is the default language.
When running Django (for example behind a reverse proxy) a request to /imprint/ with SCRIPT_NAME='script_prefix" leads to the redirect "/en/script_prefix/imprint/" instead of "/script_prefix/en/imprint/".

I've already provided a patch with test. But I'm uncertain about the test, since the test client does not seem to call set_script_prefix (might be thought of as a bug???)

Attachments (1)

i18n_patterns_with_script_name_patch.diff (2.9 KB) - added by buettgenbach@… 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by buettgenbach@…

comment:1 Changed 8 years ago by Bas Peschier

Triage Stage: UnreviewedAccepted

comment:2 Changed 8 years ago by mrhanky@…

Are there any reasons this didn't made it into Django so far?

comment:3 Changed 8 years ago by Tim Graham

No one has reviewed the patch and marked the ticket "ready for checkin".

comment:4 Changed 8 years ago by Tim Graham

Triage Stage: AcceptedReady for checkin

Patch looks okay to me. I cleaned up some trailing whitespace other flake8 issues and made a PR to make sure all the tests are passing.

comment:5 Changed 8 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In fe38be96c1769ee83c65246704d2ae435c8d4150:

Fixed #21579 -- Made LocaleMiddleware respect script prefix.

Thanks buettgenbach at for the report and patch.

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