Loading django/utils/formats.py +4 −4 Original line number Diff line number Diff line Loading @@ -40,14 +40,14 @@ def reset_format_cache(): _format_cache = {} _format_modules_cache = {} def iter_format_modules(lang): def iter_format_modules(lang, format_module_path=None): """ Does the heavy lifting of finding format modules. """ if check_for_language(lang): format_locations = ['django.conf.locale.%s'] if settings.FORMAT_MODULE_PATH: format_locations.append(settings.FORMAT_MODULE_PATH + '.%s') if format_module_path: format_locations.append(format_module_path + '.%s') format_locations.reverse() locale = to_locale(lang) locales = [locale] Loading @@ -66,7 +66,7 @@ def get_format_modules(lang=None, reverse=False): """ if lang is None: lang = get_language() modules = _format_modules_cache.setdefault(lang, list(iter_format_modules(lang))) modules = _format_modules_cache.setdefault(lang, list(iter_format_modules(lang, settings.FORMAT_MODULE_PATH))) if reverse: return list(reversed(modules)) return modules Loading tests/i18n/tests.py +2 −3 Original line number Diff line number Diff line Loading @@ -728,9 +728,8 @@ class FormattingTests(TransRealMixin, TestCase): with translation.override('de-at', deactivate=True): de_format_mod = import_module('django.conf.locale.de.formats') self.assertEqual(list(iter_format_modules('de')), [de_format_mod]) with self.settings(FORMAT_MODULE_PATH='i18n.other.locale'): test_de_format_mod = import_module('i18n.other.locale.de.formats') self.assertEqual(list(iter_format_modules('de')), [test_de_format_mod, de_format_mod]) self.assertEqual(list(iter_format_modules('de', 'i18n.other.locale')), [test_de_format_mod, de_format_mod]) def test_iter_format_modules_stability(self): """ Loading Loading
django/utils/formats.py +4 −4 Original line number Diff line number Diff line Loading @@ -40,14 +40,14 @@ def reset_format_cache(): _format_cache = {} _format_modules_cache = {} def iter_format_modules(lang): def iter_format_modules(lang, format_module_path=None): """ Does the heavy lifting of finding format modules. """ if check_for_language(lang): format_locations = ['django.conf.locale.%s'] if settings.FORMAT_MODULE_PATH: format_locations.append(settings.FORMAT_MODULE_PATH + '.%s') if format_module_path: format_locations.append(format_module_path + '.%s') format_locations.reverse() locale = to_locale(lang) locales = [locale] Loading @@ -66,7 +66,7 @@ def get_format_modules(lang=None, reverse=False): """ if lang is None: lang = get_language() modules = _format_modules_cache.setdefault(lang, list(iter_format_modules(lang))) modules = _format_modules_cache.setdefault(lang, list(iter_format_modules(lang, settings.FORMAT_MODULE_PATH))) if reverse: return list(reversed(modules)) return modules Loading
tests/i18n/tests.py +2 −3 Original line number Diff line number Diff line Loading @@ -728,9 +728,8 @@ class FormattingTests(TransRealMixin, TestCase): with translation.override('de-at', deactivate=True): de_format_mod = import_module('django.conf.locale.de.formats') self.assertEqual(list(iter_format_modules('de')), [de_format_mod]) with self.settings(FORMAT_MODULE_PATH='i18n.other.locale'): test_de_format_mod = import_module('i18n.other.locale.de.formats') self.assertEqual(list(iter_format_modules('de')), [test_de_format_mod, de_format_mod]) self.assertEqual(list(iter_format_modules('de', 'i18n.other.locale')), [test_de_format_mod, de_format_mod]) def test_iter_format_modules_stability(self): """ Loading