1
0
Fork 0
forked from github/pelican

refactored utils.strftime

This commit is contained in:
Deniz Turgut 2013-04-16 20:53:27 -04:00
commit 48f7132ba8
3 changed files with 117 additions and 44 deletions

View file

@ -10,6 +10,7 @@ from six import StringIO
import logging
from logging.handlers import BufferingHandler
import unittest
import locale
from functools import wraps
from contextlib import contextmanager
@ -148,6 +149,18 @@ def module_exists(module_name):
return True
def locale_available(locale_):
old_locale = locale.setlocale(locale.LC_TIME)
try:
locale.setlocale(locale.LC_TIME, str(locale_))
except locale.Error:
return False
else:
locale.setlocale(locale.LC_TIME, old_locale)
return True
def get_settings():
settings = _DEFAULT_CONFIG.copy()
settings['DIRECT_TEMPLATES'] = ['archives']