Ensure that /en redirects to /en-US instead of /en-us.

This commit is contained in:
James Socol 2010-04-15 21:43:37 -07:00
Родитель c509571308
Коммит c9e043a690
2 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -29,3 +29,8 @@ class TestLocaleMiddleware(TestCase):
"""Requests for /fr-FR/search should end up on /fr/search"""
reponse = self.client.get('/fr-FR/search', follow=True)
self.assertRedirects(reponse, '/fr/search', status_code=301)
def test_partial_redirect(self):
"""Ensure that /en/ gets directed to /en-US/."""
response = self.client.get('/en/search', follow=True)
self.assertRedirects(response, '/en-US/search', status_code=301)

Просмотреть файл

@ -32,7 +32,8 @@ def reverse(viewname, urlconf=None, args=None, kwargs=None, prefix=None):
def find_supported(test):
return [x for x in settings.LANGUAGE_URL_MAP if
return [settings.LANGUAGE_URL_MAP[x] for
x in settings.LANGUAGE_URL_MAP if
x.split('-', 1)[0] == test.lower().split('-', 1)[0]]