Mercurial > p > roundup > code
view website/issues/extensions/timezone.py @ 6162:9cfdbfc6d8ed
Mark entity safe and reinstall escape -- make title display right
Change to explicitly mark the string entity — as safe and
reinstate escaping of doctitle.
If this worked in the past maybe auto-escaping wasn't turned on. If it
is in the newer versions of sphinx's jinja |safe is needed now (and |e
isn't, but it doesn't seem to cause double escaping so....).
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 11 May 2020 11:12:25 -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)
