From 96b52a2283da12c11c0259b9f4eedd368b421254 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Thu, 18 Aug 2011 13:58:04 +0200 Subject: [PATCH] issue a warning in case no timezone is defined --- docs/settings.rst | 19 +++++++++++++++---- pelican/settings.py | 6 ++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index d2d1ebbc..fdca2ca3 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -67,13 +67,10 @@ Setting name (default value) what does it do? on the output path "static". By default, pelican will copy the 'images' folder to the output folder. -`TIMEZONE` (Optional) The timezone used in the date information, to +`TIMEZONE` The timezone used in the date information, to generate atom and rss feeds. - Have a look at `the wikipedia page`_ for more - information ================================================ ===================================================== -.. _the wikipedia page: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones .. [1] Default is the system locale. Default is to delete the output directory. Article permalink structure @@ -104,6 +101,20 @@ Example usage: * '/%Y/%m/' it will be something like '/2011/07/sample-post.html'. * '/%Y/%(category)s/' it will be something like '/2011/life/sample-post.html'. +Timezone +-------- + +If no timezone is defined, UTC is assumed. This means that the generated atom +and rss feeds will have wrong date information if your locale is not UTC. + +Pelican issues a warning in case this setting is not defined, as it was not +mandatory in old versions. + +Have a look at `the wikipedia page`_ to get a list of values to set your +timezone. + +.. _the wikipedia page: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones + Feed settings ============= diff --git a/pelican/settings.py b/pelican/settings.py index e8c4fd21..c7ac35ff 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -83,5 +83,11 @@ def read_settings(filename): else: log.warn("LOCALE option doesn't contain a correct value") + if not 'TIMEZONE' in context: + log.warn("No timezone information specified in the settings. Assuming your "\ + "timezone is UTC for feed generation. "\ + "Check http://docs.notmyidea.org/alexis/pelican/settings.html#timezone "\ + "for more information") + # set the locale return context