mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #17817 -- Modified LocalMiddleware to use full URLs when redirecting to i18n URLs. Thanks to Paul for keeping an eye on the standards.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17633 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -33,9 +33,12 @@ class LocaleMiddleware(object):
|
||||
language_path = '/%s%s' % (language, request.path_info)
|
||||
if settings.APPEND_SLASH and not language_path.endswith('/'):
|
||||
language_path = language_path + '/'
|
||||
|
||||
if is_valid_path(language_path, urlconf):
|
||||
return HttpResponseRedirect(
|
||||
'/%s%s' % (language, request.get_full_path()))
|
||||
language_url = "%s://%s/%s%s" % (
|
||||
request.is_secure() and 'https' or 'http',
|
||||
request.get_host(), language, request.get_full_path())
|
||||
return HttpResponseRedirect(language_url)
|
||||
translation.deactivate()
|
||||
|
||||
patch_vary_headers(response, ('Accept-Language',))
|
||||
|
||||
Reference in New Issue
Block a user