Commit 3abb0fe8 authored by Tres Seaver's avatar Tres Seaver

Include *all* pytz zone names, not just "common" ones.

Fix one fragile doctest, band-aid another.
parent ebb12c44
...@@ -1848,5 +1848,5 @@ class strftimeFormatter: ...@@ -1848,5 +1848,5 @@ class strftimeFormatter:
# Module methods # Module methods
def Timezones(): def Timezones():
"""Return the list of recognized timezone names""" """Return the list of recognized timezone names"""
return list(PytzCache._zlst) return sorted(list(PytzCache._zmap.values()))
...@@ -11,9 +11,15 @@ Function Timezones() ...@@ -11,9 +11,15 @@ Function Timezones()
Returns the list of recognized timezone names: Returns the list of recognized timezone names:
>>> from DateTime import Timezones >>> from DateTime import Timezones
>>> Timezones() # doctest: +ELLIPSIS >>> zones = set(Timezones())
[...'Brazil/Acre'... 'Brazil/DeNoronha'... 'IDLE'... 'NZST'...]
Almost all of the standard pytz timezones are included, with the exception
of some commonly-used but ambiguous abbreviations, where historical Zope
usage conflicts with the name used by pytz:
>>> import pytz
>>> [x for x in pytz.all_timezones if x not in zones]
['CET', 'EET', 'EST', 'MET', 'MST', 'WET']
Class DateTime Class DateTime
============== ==============
......
...@@ -132,7 +132,7 @@ The _zidx attribute is a list of lower-case and possibly abbreviated ...@@ -132,7 +132,7 @@ The _zidx attribute is a list of lower-case and possibly abbreviated
time zone names that can be mapped to offical zone names. time zone names that can be mapped to offical zone names.
>>> cache._zidx #doctest: +ELLIPSIS >>> cache._zidx #doctest: +ELLIPSIS
['australia/yancowinna'... 'gmt+0500'... 'europe/isle_of_man'...] [... 'australia/yancowinna'... 'gmt+0500'... 'europe/isle_of_man'...]
Note that there are more items in _zidx than in _zlst since there are Note that there are more items in _zidx than in _zlst since there are
multiple names for some time zones. multiple names for some time zones.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment