[Checkins] SVN: zc.form/trunk/src/zc/form/source.py Add USTimeZones, a source that displays timesones from pytz that start with

Aaron Lehmann aaron at zope.com
Sun Jan 28 23:46:59 EST 2007


Log message for revision 72248:
  Add USTimeZones, a source that displays timesones from pytz that start with
  'US/'.
  
  

Changed:
  A   zc.form/trunk/src/zc/form/source.py

-=-
Added: zc.form/trunk/src/zc/form/source.py
===================================================================
--- zc.form/trunk/src/zc/form/source.py	2007-01-28 12:18:41 UTC (rev 72247)
+++ zc.form/trunk/src/zc/form/source.py	2007-01-29 04:46:57 UTC (rev 72248)
@@ -0,0 +1,19 @@
+import pytz
+import zc.sourcefactory.contextual
+
+class USTimeZones(
+    zc.sourcefactory.contextual.BasicContextualSourceFactory):
+
+    """List of timezones taken from pytz"""
+
+    tzs = [tz for tz in pytz.common_timezones if 'US/' in tz]
+
+    def getValues(self, context):
+        return self.tzs
+
+    def getTitle(self, value):
+        return value
+
+    def getToken(self, value):
+        return value
+



More information about the Checkins mailing list