diff options
| author | Claude Paroz <claude@2xlibre.net> | 2013-01-11 21:27:51 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2013-01-11 21:27:51 +0100 |
| commit | bcdb4898cae2f24599b39845b8e4cd7edc202424 (patch) | |
| tree | 77e526120f3a49e2637f47281031b07c698a5db5 /django | |
| parent | f08e739bc2ba5d3530a806378087227728369464 (diff) | |
Fixed #19488 -- Made i18n_patterns redirect work with non-slash-ending paths
Thanks Daniel Gerzo for the report and the initial patch.
Diffstat (limited to 'django')
| -rw-r--r-- | django/middleware/locale.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/django/middleware/locale.py b/django/middleware/locale.py index 628782b181..f693e4d242 100644 --- a/django/middleware/locale.py +++ b/django/middleware/locale.py @@ -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()) |
