From 1c6ea5aab2a0bf52f2ed31342897a7c33068b533 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Tue, 31 May 2011 12:44:40 +0200 Subject: [PATCH] Fix locale setup in settings.py --- pelican/settings.py | 7 ++++++- samples/pelican.conf.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pelican/settings.py b/pelican/settings.py index 08c36a82..d1826710 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -2,6 +2,8 @@ import os import locale +from pelican import log + DEFAULT_THEME = os.sep.join([os.path.dirname(os.path.abspath(__file__)), "themes/notmyidea"]) _DEFAULT_CONFIG = {'PATH': None, @@ -60,6 +62,9 @@ def read_settings(filename): locales = [locales] # try to set the different locales, fallback on the default. + if not locales: + locales = _DEFAULT_CONFIG['LOCALE'] + for locale_ in locales: try: locale.setlocale(locale.LC_ALL, locale_) @@ -67,7 +72,7 @@ def read_settings(filename): except locale.Error: pass else: - warnings.warn("LOCALE option doesn't contain a correct value") + log.warn("LOCALE option doesn't contain a correct value") # set the locale return context diff --git a/samples/pelican.conf.py b/samples/pelican.conf.py index 8648e7cb..2796d561 100755 --- a/samples/pelican.conf.py +++ b/samples/pelican.conf.py @@ -7,7 +7,7 @@ GITHUB_URL = 'http://github.com/ametaireau/' DISQUS_SITENAME = "blog-notmyidea" PDF_GENERATOR = False REVERSE_CATEGORY_ORDER = True -LOCALE = 'fr_FR.utf-8' +LOCALE = "" DEFAULT_PAGINATION = 2 FEED_RSS = 'feeds/all.rss.xml'