From 1607acee4020212166848363098008e60246e8f9 Mon Sep 17 00:00:00 2001 From: Gary Wilson Jr Date: Mon, 19 Nov 2007 05:59:58 +0000 Subject: [PATCH] Fixed #5978 -- Gave `LOCALE_PATHS` a default setting of an empty tuple and removed some code that was checking for its existance in settings before accessing it. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6701 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/bin/compile-messages.py | 5 ++--- django/conf/global_settings.py | 2 ++ django/utils/translation/trans_real.py | 7 +++---- docs/settings.txt | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/django/bin/compile-messages.py b/django/bin/compile-messages.py index 8693022644..0d71413e5a 100755 --- a/django/bin/compile-messages.py +++ b/django/bin/compile-messages.py @@ -11,11 +11,10 @@ except NameError: def compile_messages(locale=None): - basedirs = [os.path.join('conf', 'locale'), 'locale'] + basedirs = (os.path.join('conf', 'locale'), 'locale') if os.environ.get('DJANGO_SETTINGS_MODULE'): from django.conf import settings - if hasattr(settings, 'LOCALE_PATHS'): - basedirs += settings.LOCALE_PATHS + basedirs += settings.LOCALE_PATHS # Gather existing directories. basedirs = set(map(os.path.abspath, filter(os.path.isdir, basedirs))) diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py index 994e908caf..2853d6c618 100644 --- a/django/conf/global_settings.py +++ b/django/conf/global_settings.py @@ -90,6 +90,8 @@ LANGUAGES_BIDI = ("he", "ar", "fa") # to load the internationalization machinery. USE_I18N = True +LOCALE_PATHS = () + # Not-necessarily-technical managers of the site. They get broken link # notifications and other various e-mails. MANAGERS = ADMINS diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py index c95c842a4f..a7259b3ce5 100644 --- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -168,10 +168,9 @@ def translation(language): res.merge(t) return res - if hasattr(settings, 'LOCALE_PATHS'): - for localepath in settings.LOCALE_PATHS: - if os.path.isdir(localepath): - res = _merge(localepath) + for localepath in settings.LOCALE_PATHS: + if os.path.isdir(localepath): + res = _merge(localepath) if projectpath and os.path.isdir(projectpath): res = _merge(projectpath) diff --git a/docs/settings.txt b/docs/settings.txt index 6241749753..0219f9853a 100644 --- a/docs/settings.txt +++ b/docs/settings.txt @@ -583,7 +583,7 @@ LOCALE_PATHS Default: ``()`` (Empty tuple) -A list of directories where Django looks for translation files. +A tuple of directories where Django looks for translation files. See the `internationalization docs section`_ explaining the variable and the default behavior.