diff --git a/pelican/contents.py b/pelican/contents.py index bdf3c9f0..f1006875 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -86,9 +86,9 @@ class Page(object): else: self.date_format = settings['DEFAULT_DATE_FORMAT'] - if isinstance(self.date_format, tuple): - locale.setlocale(locale.LC_ALL, self.date_format[0]) - self.date_format = self.date_format[1] + if isinstance(self.date_format, tuple): + locale.setlocale(locale.LC_ALL, self.date_format[0]) + self.date_format = self.date_format[1] if hasattr(self, 'date'): if platform == 'win32': diff --git a/tests/test_contents.py b/tests/test_contents.py index df2c00e6..3c58d0e5 100644 --- a/tests/test_contents.py +++ b/tests/test_contents.py @@ -1,5 +1,8 @@ from __future__ import with_statement -from unittest2 import TestCase +try: + from unittest2 import TestCase +except ImportError, e: + from unittest import TestCase from pelican.contents import Page from pelican.settings import _DEFAULT_CONFIG diff --git a/tests/test_readers.py b/tests/test_readers.py index bf7504fb..211fb9be 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -1,5 +1,9 @@ # coding: utf-8 -import unittest2 +try: + import unittest2 +except ImportError, e: + import unittest as unittest2 + import os import datetime from pelican import readers diff --git a/tests/test_settings.py b/tests/test_settings.py index e32fcef4..571f66a1 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -1,4 +1,8 @@ -import unittest2 +try: + import unittest2 +except ImportError, e: + import unittest as unittest2 + from os.path import dirname, abspath, join from pelican.settings import read_settings, _DEFAULT_CONFIG