Opened 9 years ago

Closed 9 years ago

#26271 closed Bug (fixed)

i18n_patterns() creates invalid url if no language is active

Reported by: Marten Kenbeek Owned by: nobody
Component: Core (URLs) Version: dev
Severity: Normal Keywords:
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

If get_language() returns None, reverse() in combination with i18n_patterns() will create an url prefixed with /None/ as the language code. The LocaleMiddleware will activate a different language (it falls back to settings.LANGUAGE_CODE if no other language is found), and the prefix will cause a 404.

This requires special-casing of if language_code is None in LocaleRegexURLResolver.

Change History (4)

comment:1 by Tim Graham, 9 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Claude Paroz, 9 years ago

Has patch: set

comment:3 by Simon Charette, 9 years ago

Triage Stage: AcceptedReady for checkin
Version: 1.9master

comment:4 by Claude Paroz <claude@…>, 9 years ago

Resolution: fixed
Status: newclosed

In 95ca01f9:

Fixed #26271 -- Fixed i18n_patterns resolution when no language is active

Thanks Marten Kenbeek for the report.

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