Opened 11 years ago

Closed 10 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

Description

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@… 11 years ago.

Download all attachments as: .zip

Change History (6)

by buettgenbach@…, 11 years ago

comment:1 by Bas Peschier, 11 years ago

Triage Stage: UnreviewedAccepted

comment:2 by mrhanky@…, 10 years ago

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

comment:3 by Tim Graham, 10 years ago

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

comment:4 by Tim Graham, 10 years ago

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 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: newclosed

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