Ticket #27402: locale_404_bug.diff

File locale_404_bug.diff, 706 bytes (added by Hovi, 8 years ago)
  • django/middleware/locale.py

    diff --git a/django/middleware/locale.py b/django/middleware/locale.py
    index 65a3893..74566a1 100644
    a b class LocaleMiddleware(MiddlewareMixin):  
    3737
    3838        if response.status_code == 404 and not language_from_path and i18n_patterns_used:
    3939            language_path = '/%s%s' % (language, request.path_info)
     40            if i18n_patterns_used and not prefixed_default_language and str(language) == str(settings.LANGUAGE_CODE):
     41                language_path = '/%s' % (request.path_info)
    4042            path_valid = is_valid_path(language_path, urlconf)
    4143            path_needs_slash = (
    4244                not path_valid and (
Back to Top