templates_modules_jobsdir = $(templates_modulesdir)/jobs
dist_templates_modules_select_DATA = \
- src/templates/modules/select/locale.html \
- src/templates/modules/select/timezone.html
+ src/templates/modules/select/locale.html
templates_modules_selectdir = $(templates_modulesdir)/select
import ldap
import logging
import pickle
-import pytz
import time
import tornado.locale
def locale(self):
return tornado.locale.get()
- # Timezone
-
- @property
- def timezone(self, tz=None):
- if tz is None:
- tz = self.data.timezone or ""
-
- try:
- tz = pytz.timezone(tz)
- except pytz.UnknownTimeZoneError:
- tz = pytz.timezone("UTC")
-
- return tz
-
@property
def deleted(self):
return self.data.deleted
+++ /dev/null
-<select class="form-control" name="{{ name }}" {% if id %}id="{{ id }}" aria-describedby="{{ id }}Help"{% end %}>
- <option value="">- {{ _("Auto-select") }} -</option>
-
- {% for tz in supported_timezones %}
- <option value="{{ tz }}" {% if preselect and preselect == tz %}selected="selected"{% end %}>
- {{ tz }}
- </option>
- {% end %}
-</select>
"HeadingDate" : ui_modules.HeadingDateModule,
"SelectLocale" : ui_modules.SelectLocaleModule,
- "SelectTimezone" : ui_modules.SelectTimezoneModule,
},
ui_methods = {
"extract_hostname" : self.extract_hostname,
#!/usr/bin/python
import http.client
-import pytz
import time
import tornado.locale
import tornado.web
"""
return self.request.headers.get("User-Agent", None)
- @property
- def timezone(self):
- if self.current_user:
- return self.current_user.timezone
-
- return pytz.utc
-
- def format_date(self, date, relative=True, shorter=False,
- full_format=False):
- # XXX not very precise but working for now.
- gmt_offset = self.timezone.utcoffset(date).total_seconds() / -60
-
- return self.locale.format_date(date, gmt_offset=gmt_offset,
- relative=relative, shorter=shorter, full_format=full_format)
+ def format_date(self, date, relative=True, shorter=False, full_format=False):
+ return self.locale.format_date(date, relative=relative,
+ shorter=shorter, full_format=full_format)
def get_template_namespace(self):
ns = tornado.web.RequestHandler.get_template_namespace(self)
import pygments
import pygments.formatters
import pygments.lexers
-import pytz
import re
import tornado.web
def render(self, name=None, id=None, preselect=None):
return self.render_string("modules/select/locale.html",
name=name, id=id, preselect=preselect, supported_locales=self.LOCALE_NAMES)
-
-
-class SelectTimezoneModule(UIModule):
- def render(self, name=None, id=None, preselect=None):
- return self.render_string("modules/select/timezone.html",
- name=name, id=id, preselect=preselect,
- supported_timezones=pytz.common_timezones)