Skip to content
Permalink
Browse files

fix #1599 -- fix zoneinfo reading (dateutil 2.4.0)

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information...
Kwpolska committed Jan 23, 2015
1 parent 4d334f7 commit aea500e7c9dfe7552728e10df126f285ccef3687
Showing with 7 additions and 4 deletions.
  1. +1 −0 CHANGES.txt
  2. +6 −4 nikola/plugins/command/init.py
@@ -10,6 +10,7 @@ Features
Bugfixes
--------

* Fix zoneinfo reading in ``nikola init`` (Issue #1599)
* Fix ``.islink`` detection for galleries (via Issue #1536)
* Links to languages point to site root and not the blog (Issue #1008)
* Brand link is now language-specific (Issue #1573)
@@ -319,13 +319,15 @@ def tzhandler(default, toconf):
tz = dateutil.tz.gettz(answer)

if tz is None:
print(" WARNING: Time zone not found. Searching most common timezones for a match.")
zonesfile = tarfile.TarFile.open(os.path.join(dateutil.zoneinfo.ZONEINFOFILE))
print(" WARNING: Time zone not found. Searching list of time zones for a match.")
zonesfile = tarfile.open(fileobj=dateutil.zoneinfo.getzoneinfofile_stream())
zonenames = [zone for zone in zonesfile.getnames() if answer.lower() in zone.lower()]
if len(zonenames) == 1:
tz = dateutil.tz.gettz(zonenames[0])
answer = zonenames[0]
print(" Picking '{0}'.".format(answer))
elif len(zonenames) > 1:
print(" Could not pick one timezone. Choose one of the following:")
print(" The following time zones match your query:")
print(' ' + '\n '.join(zonenames))
continue

@@ -334,7 +336,7 @@ def tzhandler(default, toconf):
print(" Current time in {0}: {1}".format(answer, time))
answered = ask_yesno("Use this time zone?", True)
else:
print(" ERROR: Time zone not found. Please try again. Time zones are case-sensitive.")
print(" ERROR: No matches found. Please try again.")

SAMPLE_CONF['TIMEZONE'] = answer

0 comments on commit aea500e

Please sign in to comment.
You can’t perform that action at this time.