From 06246d1aa42cc2925aea0695828247711a95ed93 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Tue, 1 Feb 2011 22:49:33 +0000 Subject: [PATCH] Fix #65. Unicode, grr. Thanks Bruno Bord. --- pelican/contents.py | 8 ++++---- pelican/generators.py | 1 + pelican/readers.py | 1 + pelican/settings.py | 1 + samples/content/super_article.rst | 2 +- samples/pelican.conf.py | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pelican/contents.py b/pelican/contents.py index 1ace659f..938315f7 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from pelican.utils import slugify, truncate_html_words @@ -53,6 +54,9 @@ class Page(object): else: self.date_format = settings['DEFAULT_DATE_FORMAT'] + if hasattr(self, 'date'): + self.locale_date = self.date.strftime(self.date_format).decode('utf') + # store the settings ref. self._settings = settings @@ -74,10 +78,6 @@ class Page(object): def summary(self): return truncate_html_words(self.content, 50) - @property - def locale_date(self): - return self.date.strftime(self.date_format) - class Article(Page): diff --git a/pelican/generators.py b/pelican/generators.py index a2ea3593..c50b55e1 100755 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from operator import attrgetter from itertools import chain from functools import partial diff --git a/pelican/readers.py b/pelican/readers.py index 1fc51f68..47e7d9f0 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from docutils import core from markdown import Markdown import re diff --git a/pelican/settings.py b/pelican/settings.py index 3070ad15..d84178fe 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import os import locale diff --git a/samples/content/super_article.rst b/samples/content/super_article.rst index 3b9f9adc..e2f933d2 100644 --- a/samples/content/super_article.rst +++ b/samples/content/super_article.rst @@ -2,7 +2,7 @@ This is a super article ! ######################### :tags: foo, bar, foobar -:date: 2010-10-02 10:14 +:date: 2010-12-02 10:14 :category: yeah :author: Alexis Métaireau diff --git a/samples/pelican.conf.py b/samples/pelican.conf.py index 89a4332f..122c8c4a 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 = 'en_US.utf8' +LOCALE = 'fr_FR.utf8' LINKS = (('Biologeek', 'http://biologeek.org'), ('Filyb', "http://filyb.info/"),