#21579 closed Bug (fixed)

i18n_patterns redirect not working with script prefix (sub path)

Reported by: buettgenbach@… Owned by: nobody
Component: Core (URLs) Version: master
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@… 22 months ago.

Download all attachments as: .zip

Change History (6)

Changed 22 months ago by buettgenbach@…

comment:1 Changed 20 months ago by bpeschier

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 17 months ago by mrhanky@…

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

comment:3 Changed 17 months ago by timo

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

comment:4 Changed 14 months ago by timgraham

  • Triage Stage changed from Accepted to Ready 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 14 months ago by Tim Graham <timograham@…>

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

In fe38be96c1769ee83c65246704d2ae435c8d4150:

Fixed #21579 -- Made LocaleMiddleware respect script prefix.

Thanks buettgenbach at datacollect.com for the report and patch.

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