Ticket #21749: locale_middleware_redirect.diff

File locale_middleware_redirect.diff, 969 bytes (added by Tilman Koschnick, 11 years ago)
  • django/middleware/locale.py

    diff --git a/django/middleware/locale.py b/django/middleware/locale.py
    index 1f64387..e696ff4 100644
    a b class LocaleMiddleware(object):  
    5050                path_valid = is_valid_path("%s/" % language_path, urlconf)
    5151
    5252            if path_valid:
    53                 language_url = "%s://%s/%s%s" % (
    54                     request.scheme, request.get_host(), language,
    55                     request.get_full_path())
     53                prefix = request.META.get('SCRIPT_NAME', '')
     54                query = request.META.get('QUERY_STRING')
     55                query = '?%s' % query if query else ''
     56                language_url = "%s://%s%s/%s%s%s" % (
     57                    request.scheme, request.get_host(), prefix,
     58                    language, request.path_info, query)
    5659                return self.response_redirect_class(language_url)
    5760
    5861        if not (self.is_language_prefix_patterns_used()
Back to Top