1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #19488 -- Made i18n_patterns redirect work with non-slash-ending paths

Thanks Daniel Gerzo for the report and the initial patch.
This commit is contained in:
Claude Paroz
2013-01-11 21:27:51 +01:00
parent f08e739bc2
commit bcdb4898ca
3 changed files with 10 additions and 3 deletions

View File

@@ -31,10 +31,12 @@ class LocaleMiddleware(object):
and self.is_language_prefix_patterns_used()):
urlconf = getattr(request, 'urlconf', None)
language_path = '/%s%s' % (language, request.path_info)
if settings.APPEND_SLASH and not language_path.endswith('/'):
language_path = language_path + '/'
path_valid = is_valid_path(language_path, urlconf)
if (not path_valid and settings.APPEND_SLASH
and not language_path.endswith('/')):
path_valid = is_valid_path("%s/" % language_path, urlconf)
if is_valid_path(language_path, urlconf):
if path_valid:
language_url = "%s://%s/%s%s" % (
request.is_secure() and 'https' or 'http',
request.get_host(), language, request.get_full_path())