Fixed #26945 -- Ensured that i18n_patterns returns a list
This commit is contained in:
parent
32cf01c1c1
commit
971120778a
|
@ -12,7 +12,7 @@ def i18n_patterns(*urls, **kwargs):
|
||||||
URLconf.
|
URLconf.
|
||||||
"""
|
"""
|
||||||
if not settings.USE_I18N:
|
if not settings.USE_I18N:
|
||||||
return urls
|
return list(urls)
|
||||||
prefix_default_language = kwargs.pop('prefix_default_language', True)
|
prefix_default_language = kwargs.pop('prefix_default_language', True)
|
||||||
assert not kwargs, 'Unexpected kwargs for i18n_patterns(): %s' % kwargs
|
assert not kwargs, 'Unexpected kwargs for i18n_patterns(): %s' % kwargs
|
||||||
return [LocaleRegexURLResolver(list(urls), prefix_default_language=prefix_default_language)]
|
return [LocaleRegexURLResolver(list(urls), prefix_default_language=prefix_default_language)]
|
||||||
|
|
|
@ -1525,6 +1525,12 @@ class MiscTests(SimpleTestCase):
|
||||||
with self.settings(LANGUAGES=[('en', 'English')]):
|
with self.settings(LANGUAGES=[('en', 'English')]):
|
||||||
self.assertNotEqual('pt-br', g(r))
|
self.assertNotEqual('pt-br', g(r))
|
||||||
|
|
||||||
|
def test_i18n_patterns_returns_list(self):
|
||||||
|
with override_settings(USE_I18N=False):
|
||||||
|
self.assertIsInstance(i18n_patterns([]), list)
|
||||||
|
with override_settings(USE_I18N=True):
|
||||||
|
self.assertIsInstance(i18n_patterns([]), list)
|
||||||
|
|
||||||
|
|
||||||
class ResolutionOrderI18NTests(SimpleTestCase):
|
class ResolutionOrderI18NTests(SimpleTestCase):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue