[Zope-Checkins] SVN: Zope/trunk/lib/python/DateTime/ Include *all* pytz zone names, not just "common" ones.
Tres Seaver
tseaver at palladion.com
Thu Dec 4 09:43:47 EST 2008
Log message for revision 93620:
Include *all* pytz zone names, not just "common" ones.
Fix one fragile doctest, band-aid another.
Changed:
U Zope/trunk/lib/python/DateTime/DateTime.py
U Zope/trunk/lib/python/DateTime/DateTime.txt
U Zope/trunk/lib/python/DateTime/pytz.txt
-=-
Modified: Zope/trunk/lib/python/DateTime/DateTime.py
===================================================================
--- Zope/trunk/lib/python/DateTime/DateTime.py 2008-12-04 13:34:09 UTC (rev 93619)
+++ Zope/trunk/lib/python/DateTime/DateTime.py 2008-12-04 14:43:47 UTC (rev 93620)
@@ -1848,5 +1848,5 @@
# Module methods
def Timezones():
"""Return the list of recognized timezone names"""
- return list(PytzCache._zlst)
+ return sorted(list(PytzCache._zmap.values()))
Modified: Zope/trunk/lib/python/DateTime/DateTime.txt
===================================================================
--- Zope/trunk/lib/python/DateTime/DateTime.txt 2008-12-04 13:34:09 UTC (rev 93619)
+++ Zope/trunk/lib/python/DateTime/DateTime.txt 2008-12-04 14:43:47 UTC (rev 93620)
@@ -11,10 +11,16 @@
Returns the list of recognized timezone names:
>>> from DateTime import Timezones
- >>> Timezones() # doctest: +ELLIPSIS
- [...'Brazil/Acre'... 'Brazil/DeNoronha'... 'IDLE'... 'NZST'...]
+ >>> zones = set(Timezones())
+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
==============
Modified: Zope/trunk/lib/python/DateTime/pytz.txt
===================================================================
--- Zope/trunk/lib/python/DateTime/pytz.txt 2008-12-04 13:34:09 UTC (rev 93619)
+++ Zope/trunk/lib/python/DateTime/pytz.txt 2008-12-04 14:43:47 UTC (rev 93620)
@@ -132,7 +132,7 @@
time zone names that can be mapped to offical zone names.
>>> 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
multiple names for some time zones.
More information about the Zope-Checkins
mailing list