forked from github/pelican
Fix #1198, enable custom locale in template rendering, fixes links
reverts getpelican/pelican@ddcccfeaa9 If one used a locale that made use of unicode characters (like fr_FR.UTF-8) the files on disk would be in correct locale while links would be to C. Uses a SafeDatetime class that works with unicode format strigns by using custom strftime to prevent ascii decoding errors with Python2. Also added unicode decoding for the calendar module to fix period archives.
This commit is contained in:
parent
2432a22400
commit
3f6b130d6e
91 changed files with 5704 additions and 77 deletions
|
|
@ -2,7 +2,6 @@
|
|||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import six
|
||||
from datetime import datetime
|
||||
from sys import platform
|
||||
import locale
|
||||
|
||||
|
|
@ -10,7 +9,7 @@ from pelican.tests.support import unittest, get_settings
|
|||
|
||||
from pelican.contents import Page, Article, URLWrapper
|
||||
from pelican.settings import DEFAULT_CONFIG
|
||||
from pelican.utils import truncate_html_words
|
||||
from pelican.utils import truncate_html_words, SafeDatetime
|
||||
from pelican.signals import content_object_init
|
||||
from jinja2.utils import generate_lorem_ipsum
|
||||
|
||||
|
|
@ -127,7 +126,7 @@ class TestPage(unittest.TestCase):
|
|||
|
||||
def test_datetime(self):
|
||||
# If DATETIME is set to a tuple, it should be used to override LOCALE
|
||||
dt = datetime(2015, 9, 13)
|
||||
dt = SafeDatetime(2015, 9, 13)
|
||||
|
||||
page_kwargs = self._copy_page_kwargs()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue