Skip to content
Permalink
Browse files
Fix #3006 - use documented dateutil API for time zone list
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Apr 2, 2018
1 parent 2d759c5 commit 68b2ae8f712004f076dd229b2fff76cab8502957
Showing with 9 additions and 8 deletions.
  1. +1 −0 CHANGES.txt
  2. +7 −7 nikola/plugins/command/init.py
  3. +1 −1 requirements.txt
@@ -38,6 +38,7 @@ Features
Bugfixes
--------

* Use documented dateutil API for time zone list (Issue #3006)
* Handle trailing slash redirects with query strings correctly in
``nikola serve`` (Issue #3000)
* Fix w3c validation errors for itemscope entries in default themes
@@ -384,15 +384,15 @@ def tzhandler(default, toconf):

if tz is None:
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]
all_zones = dateutil.zoneinfo.get_zonefile_instance().zones
matching_zones = [zone for zone in all_zones if answer.lower() in zone.lower()]
if len(matching_zones) == 1:
tz = dateutil.tz.gettz(matching_zones[0])
answer = matching_zones[0]
print(" Picking '{0}'.".format(answer))
elif len(zonenames) > 1:
elif len(matching_zones) > 1:
print(" The following time zones match your query:")
print(' ' + '\n '.join(zonenames))
print(' ' + '\n '.join(matching_zones))
continue

if tz is not None:
@@ -1,7 +1,7 @@
doit>=0.30.1
Pygments>=1.6
Pillow>=2.4.0
python-dateutil>=2.4.0
python-dateutil>=2.6.0
docutils>=0.13
mako>=1.0.0
Markdown>=2.4.0

0 comments on commit 68b2ae8

Please sign in to comment.