view website/issues/extensions/timezone.py @ 5277:b580f61929e2

Removing richard from notification list. Verified that he doesn't want to be on it anymore. Date: Sun, 24 Sep 2017 14:58:24 +1000 To: rouiljsomewhere From: Richard Jones <r1chardj0n3s at gmail.com> Subject: Re: Do you still want new issues to roundup tracker sent to you? --94eb2c0da3aac771bb0559e84afb Content-Type: text/plain; charset="UTF-8" Thanks John, yes please do remove me. Richard On 24 September 2017 at 14:13, John P. Rouillard <rouilj at cs.umb.edu> wrote: > Hi Richard: > > I am working on updating the roundup tracker to > get it ready for the current development code. > > As I was testing I noticed you are still in the > list of email addresses getting new issue emails. > > Do you want to continue to receive these since > you aren't actively developing roundup?
author John Rouillard <rouilj@ieee.org>
date Sun, 24 Sep 2017 18:44:48 -0400
parents 7d8e0dbb0852
children
line wrap: on
line source

# Utility for replacing the simple input field for the timezone with
# a select-field that lists the available values.

import cgi

try:
    import pytz
except ImportError:
    pytz = None


def tzfield(prop, name, default):
    if pytz:
        value = prop.plain()        
        if '' == value:
            value = default
        else:
            try:
                value = "Etc/GMT%+d" % int(value)
            except ValueError:
                pass

        l = ['<select name="%s">' % name]
        for zone in pytz.all_timezones:
            s = ' '
            if zone == value:
                s = 'selected=selected '
            z = cgi.escape(zone)
            l.append('<option %svalue="%s">%s</option>' % (s, z, z))
        l.append('</select>')
        return '\n'.join(l)
        
    else:
        return prop.field()

def init(instance):
    instance.registerUtil('tzfield', tzfield)

Roundup Issue Tracker: http://roundup-tracker.org/