diff --git a/pelican/contents.py b/pelican/contents.py index 297a537b..7a9a8bc0 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -16,7 +16,7 @@ from pelican import signals from pelican.settings import DEFAULT_CONFIG from pelican.utils import (slugify, truncate_html_words, memoized, strftime, python_2_unicode_compatible, deprecated_attribute, - path_to_url, SafeDatetime) + path_to_url, set_date_tzinfo, SafeDatetime) # Import these so that they're avalaible when you import from pelican.contents. from pelican.urlwrappers import (URLWrapper, Author, Category, Tag) # NOQA @@ -117,9 +117,16 @@ class Content(object): locale.setlocale(locale.LC_ALL, locale_string) self.date_format = self.date_format[1] + # manage timezone + default_timezone = settings.get('TIMEZONE', 'UTC') + timezone = getattr(self, 'timezone', default_timezone) + if hasattr(self, 'date'): + self.date = set_date_tzinfo(self.date, timezone) self.locale_date = strftime(self.date, self.date_format) + if hasattr(self, 'modified'): + self.modified = set_date_tzinfo(self.modified, timezone) self.locale_modified = strftime(self.modified, self.date_format) # manage status diff --git a/pelican/tests/output/basic/a-markdown-powered-article.html b/pelican/tests/output/basic/a-markdown-powered-article.html index 40c96766..5fcc42a9 100644 --- a/pelican/tests/output/basic/a-markdown-powered-article.html +++ b/pelican/tests/output/basic/a-markdown-powered-article.html @@ -34,7 +34,7 @@
- \ No newline at end of file + diff --git a/pelican/tests/output/basic/archives.html b/pelican/tests/output/basic/archives.html index e32c92ba..f8f1a67f 100644 --- a/pelican/tests/output/basic/archives.html +++ b/pelican/tests/output/basic/archives.html @@ -69,4 +69,4 @@ - \ No newline at end of file + diff --git a/pelican/tests/output/basic/article-1.html b/pelican/tests/output/basic/article-1.html index 15a1496d..4ea7f4e3 100644 --- a/pelican/tests/output/basic/article-1.html +++ b/pelican/tests/output/basic/article-1.html @@ -34,7 +34,7 @@
- + Published: Thu 17 February 2011 @@ -65,4 +65,4 @@
- \ No newline at end of file + diff --git a/pelican/tests/output/basic/article-2.html b/pelican/tests/output/basic/article-2.html index c4b09e35..45130e55 100644 --- a/pelican/tests/output/basic/article-2.html +++ b/pelican/tests/output/basic/article-2.html @@ -34,7 +34,7 @@
- + Published: Thu 17 February 2011 @@ -65,4 +65,4 @@
- \ No newline at end of file + diff --git a/pelican/tests/output/basic/article-3.html b/pelican/tests/output/basic/article-3.html index 1c07e5e2..8603430f 100644 --- a/pelican/tests/output/basic/article-3.html +++ b/pelican/tests/output/basic/article-3.html @@ -34,7 +34,7 @@
- + Published: Thu 17 February 2011 @@ -65,4 +65,4 @@
- \ No newline at end of file + diff --git a/pelican/tests/output/basic/author/alexis-metaireau.html b/pelican/tests/output/basic/author/alexis-metaireau.html index d1dc6da6..11d54185 100644 --- a/pelican/tests/output/basic/author/alexis-metaireau.html +++ b/pelican/tests/output/basic/author/alexis-metaireau.html @@ -29,11 +29,11 @@

This is a super article !

- + Published: Thu 02 December 2010
- + Updated: Sun 17 November 2013 @@ -69,7 +69,7 @@
- + Published: Wed 20 October 2010 @@ -109,4 +109,4 @@ YEAH !

- \ No newline at end of file + diff --git a/pelican/tests/output/basic/categories.html b/pelican/tests/output/basic/categories.html index fa2fc012..55e955c8 100644 --- a/pelican/tests/output/basic/categories.html +++ b/pelican/tests/output/basic/categories.html @@ -49,4 +49,4 @@
- \ No newline at end of file + diff --git a/pelican/tests/output/basic/category/bar.html b/pelican/tests/output/basic/category/bar.html index 763cfe77..18e434cb 100644 --- a/pelican/tests/output/basic/category/bar.html +++ b/pelican/tests/output/basic/category/bar.html @@ -29,7 +29,7 @@

Oh yeah !