imip-agent

Change of imip_manager.py

401:1a2872e3a482
imip_manager.py
     1.1 --- a/imip_manager.py	Mon Mar 09 22:35:23 2015 +0100
     1.2 +++ b/imip_manager.py	Tue Mar 10 16:38:46 2015 +0100
     1.3 @@ -26,6 +26,7 @@
     1.4  
     1.5  from datetime import date, datetime, timedelta
     1.6  import babel.dates
     1.7 +import pytz
     1.8  import cgi, os, sys
     1.9  
    1.10  sys.path.append(LIBRARY_PATH)
    1.11 @@ -1912,12 +1913,19 @@
    1.12          page.add(":")
    1.13          page.input(name="%s-second" % name, type="text", value=second, maxlength=2, size=2)
    1.14          page.add(" ")
    1.15 -        self._show_menu("%s-tzid" % name, event_tzid,
    1.16 -            [(event_tzid, event_tzid)] + (
    1.17 -            event_tzid != tzid and [(tzid, tzid)] or []
    1.18 -            ))
    1.19 +        self._show_timezone_menu("%s-tzid" % name, event_tzid)
    1.20          page.span.close()
    1.21  
    1.22 +    def _show_timezone_menu(self, name, default):
    1.23 +
    1.24 +        """
    1.25 +        Show timezone controls using a menu with the given 'name', set to the
    1.26 +        given 'default' unless a field of the given 'name' provides a value.
    1.27 +        """
    1.28 +
    1.29 +        entries = [(tzid, tzid) for tzid in pytz.all_timezones]
    1.30 +        self._show_menu(name, default, entries)
    1.31 +
    1.32      # Incoming HTTP request direction.
    1.33  
    1.34      def select_action(self):