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
This commit is contained in:
Gary Wilson Jr 2007-11-19 05:59:58 +00:00
parent 331d4bba97
commit 1607acee40
4 changed files with 8 additions and 8 deletions

View File

@ -11,11 +11,10 @@ except NameError:
def compile_messages(locale=None): 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'): if os.environ.get('DJANGO_SETTINGS_MODULE'):
from django.conf import settings from django.conf import settings
if hasattr(settings, 'LOCALE_PATHS'): basedirs += settings.LOCALE_PATHS
basedirs += settings.LOCALE_PATHS
# Gather existing directories. # Gather existing directories.
basedirs = set(map(os.path.abspath, filter(os.path.isdir, basedirs))) basedirs = set(map(os.path.abspath, filter(os.path.isdir, basedirs)))

View File

@ -90,6 +90,8 @@ LANGUAGES_BIDI = ("he", "ar", "fa")
# to load the internationalization machinery. # to load the internationalization machinery.
USE_I18N = True USE_I18N = True
LOCALE_PATHS = ()
# Not-necessarily-technical managers of the site. They get broken link # Not-necessarily-technical managers of the site. They get broken link
# notifications and other various e-mails. # notifications and other various e-mails.
MANAGERS = ADMINS MANAGERS = ADMINS

View File

@ -168,10 +168,9 @@ def translation(language):
res.merge(t) res.merge(t)
return res return res
if hasattr(settings, 'LOCALE_PATHS'): for localepath in settings.LOCALE_PATHS:
for localepath in settings.LOCALE_PATHS: if os.path.isdir(localepath):
if os.path.isdir(localepath): res = _merge(localepath)
res = _merge(localepath)
if projectpath and os.path.isdir(projectpath): if projectpath and os.path.isdir(projectpath):
res = _merge(projectpath) res = _merge(projectpath)

View File

@ -583,7 +583,7 @@ LOCALE_PATHS
Default: ``()`` (Empty tuple) 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 See the `internationalization docs section`_ explaining the variable and the
default behavior. default behavior.