diff --git a/CHANGES.txt b/CHANGES.txt index 0b15e731ec..d510b216ed 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -12,6 +12,8 @@ Features Bugfixes -------- +* sanitized dates generated by new_post by forcing an ISO 8601-esque + format of YYYY-mm-dd HH:MM:SS (Issues #1284, #1313) * made github_deploy compatible with Python 3 (Issue #1311) * rebuild stuff on TranslatableSettings’ change (Issue #1297) * made bootstrap-jinja and bootstrap3-jinja work again, assets were missing diff --git a/docs/creating-a-theme.txt b/docs/creating-a-theme.txt index 4fe94011ee..220a8e78e2 100644 --- a/docs/creating-a-theme.txt +++ b/docs/creating-a-theme.txt @@ -1,6 +1,6 @@ .. title: Creating a Theme .. slug: creating-a-theme -.. date: 2012/03/13 12:00 +.. date: 2012-03-13 12:00:00 UTC-03:00 .. tags: .. link: .. description: diff --git a/docs/extending.txt b/docs/extending.txt index 7f9177f53b..2149088c3f 100644 --- a/docs/extending.txt +++ b/docs/extending.txt @@ -1,6 +1,6 @@ .. title: Extending Nikola .. slug: extending -.. date: 2012/03/30 23:00 +.. date: 2012-03-30 23:00:00 UTC-03:00 .. tags: .. link: .. description: diff --git a/docs/internals.txt b/docs/internals.txt index 06a27477d2..a025075244 100644 --- a/docs/internals.txt +++ b/docs/internals.txt @@ -1,6 +1,6 @@ .. title: Nikola Internals .. slug: internals -.. date: 2012/03/30 23:00 +.. date: 2012-03-30 23:00:00 UTC-03:00 .. tags: .. link: .. description: diff --git a/docs/manual.txt b/docs/manual.txt index 82160c17b2..3bbbc59df3 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -1,6 +1,6 @@ .. title: The Nikola Handbook .. slug: handbook -.. date: 2012/03/30 23:00 +.. date: 2012-03-30 23:00:00 UTC-03:00 .. tags: .. link: .. description: @@ -459,7 +459,7 @@ The content of that file is as follows:: .. title: How to make money .. slug: how-to-make-money - .. date: 2012/09/15 19:52:05 + .. date: 2012-09-15 19:52:05 UTC .. tags: .. link: .. description: @@ -534,7 +534,7 @@ to your configuration:: How to make money how-to-make-money - 2012/09/15 19:52:05 + 2012-09-15 19:52:05 UTC However, starting with Nikola v7, you can now use ``.meta`` files and put all metadata you want, complete with the explanations — they look just like @@ -542,7 +542,10 @@ to your configuration:: .. title: How to make money .. slug: how-to-make-money - .. date: 2012/09/15 19:52:05 + .. date: 2012-09-15 19:52:05 UTC + + Both file formats are supported; however, the new format is preferred, if + possible. If you are writing a multilingual site, you can also create a per-language post file (for example: ``how-to-make-money.es.txt`` with the default TRANSLATIONS_PATTERN, see below). diff --git a/docs/social_buttons.txt b/docs/social_buttons.txt index 1731c9077b..d465190690 100644 --- a/docs/social_buttons.txt +++ b/docs/social_buttons.txt @@ -1,6 +1,6 @@ .. title: Alternative Social Buttons .. slug: social_buttons -.. date: 2013/08/19 23:00 +.. date: 2013-08-19 23:00:00 UTC-03:00 .. tags: .. link: .. description: diff --git a/docs/theming.txt b/docs/theming.txt index 89f70c505a..b60916567a 100644 --- a/docs/theming.txt +++ b/docs/theming.txt @@ -1,6 +1,6 @@ .. title: Theming Nikola .. slug: theming -.. date: 2012/03/13 12:00 +.. date: 2012-03-13 12:00:00 UTC-03:00 .. tags: .. link: .. description: diff --git a/docs/upgrading-to-v6.txt b/docs/upgrading-to-v6.txt index 1d28014b82..e086b0c11c 100644 --- a/docs/upgrading-to-v6.txt +++ b/docs/upgrading-to-v6.txt @@ -1,6 +1,6 @@ .. title: Upgrading to v6 .. slug: upgrading-to-v6 -.. date: 2013/08/23 23:00 +.. date: 2013-08-23 23:00:00 UTC-03:00 .. tags: .. link: .. description: diff --git a/nikola/data/samplesite/posts/1.rst b/nikola/data/samplesite/posts/1.rst index 6e47cbd9b2..7116a7a957 100644 --- a/nikola/data/samplesite/posts/1.rst +++ b/nikola/data/samplesite/posts/1.rst @@ -1,6 +1,6 @@ .. title: Welcome to Nikola .. slug: welcome-to-nikola -.. date: 2012/03/30 23:00 +.. date: 2012-03-30 23:00:00 UTC-03:00 .. tags: nikola, python, demo, blog .. author: Roberto Alsina .. link: http://getnikola.com diff --git a/nikola/data/samplesite/stories/1.rst b/nikola/data/samplesite/stories/1.rst index 27c75d86eb..b662fae617 100644 --- a/nikola/data/samplesite/stories/1.rst +++ b/nikola/data/samplesite/stories/1.rst @@ -1,6 +1,6 @@ .. title: Nikola: it generates static .. slug: about-nikola -.. date: 2012/03/30 23:00 +.. date: 2012-03-30 23:00:00 UTC-03:00 .. tags: .. link: .. description: diff --git a/nikola/data/samplesite/stories/a-study-in-scarlet.txt b/nikola/data/samplesite/stories/a-study-in-scarlet.txt index 10f952871a..2dfee525c8 100644 --- a/nikola/data/samplesite/stories/a-study-in-scarlet.txt +++ b/nikola/data/samplesite/stories/a-study-in-scarlet.txt @@ -1,7 +1,7 @@ .. link: .. description: .. tags: -.. date: 2013/08/27 18:20:55 +.. date: 2013-08-27 18:20:55 UTC-03:00 .. title: A STUDY IN SCARLET. .. slug: a-study-in-scarlet diff --git a/nikola/data/samplesite/stories/bootstrap-demo.rst b/nikola/data/samplesite/stories/bootstrap-demo.rst index 520e4b051d..a7be1a9610 100644 --- a/nikola/data/samplesite/stories/bootstrap-demo.rst +++ b/nikola/data/samplesite/stories/bootstrap-demo.rst @@ -1,6 +1,6 @@ .. title: Bootstrap Demo .. slug: bootstrap-demo -.. date: 2012/03/30 23:00 +.. date: 2012-03-30 23:00:00 UTC-03:00 .. tags: bootstrap, demo .. link: http://getnikola.com .. description: diff --git a/nikola/data/samplesite/stories/charts.txt b/nikola/data/samplesite/stories/charts.txt index 2c90fdf63e..72fedb108d 100644 --- a/nikola/data/samplesite/stories/charts.txt +++ b/nikola/data/samplesite/stories/charts.txt @@ -1,7 +1,7 @@ .. link: .. description: .. tags: -.. date: 2013/08/27 18:20:55 +.. date: 2013-08-27 18:20:55 UTC-03:00 .. title: Charts .. slug: charts diff --git a/nikola/data/samplesite/stories/listings-demo.rst b/nikola/data/samplesite/stories/listings-demo.rst index 7875f178a8..3bb8dc6bee 100644 --- a/nikola/data/samplesite/stories/listings-demo.rst +++ b/nikola/data/samplesite/stories/listings-demo.rst @@ -1,6 +1,6 @@ .. title: Listings Demo .. slug: listings-demo -.. date: 2012/12/15 10:16:20 +.. date: 2012-12-15 10:16:20 UTC-03:00 .. tags: .. link: .. description: diff --git a/nikola/data/samplesite/stories/quickref.rst b/nikola/data/samplesite/stories/quickref.rst index 52e786f896..7886cd1c0e 100644 --- a/nikola/data/samplesite/stories/quickref.rst +++ b/nikola/data/samplesite/stories/quickref.rst @@ -1,6 +1,6 @@ .. title: A reStructuredText Reference .. slug: quickref -.. date: 2012/03/30 23:00 +.. date: 2012-03-30 23:00:00 UTC-03:00 .. tags: .. link: .. description: diff --git a/nikola/data/samplesite/stories/quickstart.rst b/nikola/data/samplesite/stories/quickstart.rst index 4282b23c13..5b78807ae5 100644 --- a/nikola/data/samplesite/stories/quickstart.rst +++ b/nikola/data/samplesite/stories/quickstart.rst @@ -1,6 +1,6 @@ .. title: A reStructuredText Primer .. slug: quickstart -.. date: 2012/03/30 23:00 +.. date: 2012-03-30 23:00:00 UTC-03:00 .. tags: .. link: .. description: diff --git a/nikola/data/samplesite/stories/slides-demo.rst b/nikola/data/samplesite/stories/slides-demo.rst index fb1356b156..0d07bbc1e3 100644 --- a/nikola/data/samplesite/stories/slides-demo.rst +++ b/nikola/data/samplesite/stories/slides-demo.rst @@ -1,6 +1,6 @@ .. title: Slides Demo .. slug: slides-demo -.. date: 2012/12/27 10:16:20 +.. date: 2012-12-27 10:16:20 UTC-03:00 .. tags: .. link: .. description: diff --git a/nikola/plugins/command/new_post.py b/nikola/plugins/command/new_post.py index 6ddbdb5c8f..42f77cce0e 100644 --- a/nikola/plugins/command/new_post.py +++ b/nikola/plugins/command/new_post.py @@ -27,7 +27,6 @@ from __future__ import unicode_literals, print_function import codecs import datetime -import locale import os import sys import subprocess @@ -129,16 +128,13 @@ def get_date(schedule=False, rule=None, last_date=None, tz=None, iso8601=False): offset_min = offset_sec % 3600 if iso8601: tz_str = '{0:+03d}:{1:02d}'.format(offset_hrs, offset_min // 60) - return date.strftime('%Y-%m-%dT%T') + tz_str else: if offset: tz_str = ' UTC{0:+03d}:{1:02d}'.format(offset_hrs, offset_min // 60) else: tz_str = ' UTC' - return date.strftime('{0} {1}'.format( - locale.nl_langinfo(locale.D_FMT), - locale.nl_langinfo(locale.T_FMT), - )) + tz_str + + return date.strftime('%Y-%m-%d %H:%M:%S') + tz_str class CommandNewPost(Command): diff --git a/tests/test_scheduling.py b/tests/test_scheduling.py index 1fc447df16..ae1cf92c18 100644 --- a/tests/test_scheduling.py +++ b/tests/test_scheduling.py @@ -46,9 +46,7 @@ def tearDown(cls): def test_get_date(self): from nikola.plugins.command.new_post import get_date - # This is now locale-dependent, so do it here, where - # locale is set. - FMT = '{0} {1} %Z'.format( + FMT = '%Y-%m-%d %H:%M:%S %Z'.format( locale.nl_langinfo(locale.D_FMT), locale.nl_langinfo(locale.T_FMT), )