]> git.ipfire.org Git - pbs.git/commitdiff
users: Drop any timezone stuff
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 14 Oct 2022 17:43:04 +0000 (17:43 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 14 Oct 2022 17:43:04 +0000 (17:43 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/buildservice/users.py
src/templates/modules/select/timezone.html [deleted file]
src/web/__init__.py
src/web/base.py
src/web/ui_modules.py

index 65d49fde1d1af8ad9888f881e8a3450ec2f93294..62f781fc9f9cb862b159587894a38b61ca4757e5 100644 (file)
@@ -285,8 +285,7 @@ dist_templates_modules_jobs_DATA = \
 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
 
index 56f31b46e6c40871c4f52563c310074e624fb58e..12bb44fd56d8582e519c353636ffa4e62f627a50 100644 (file)
@@ -5,7 +5,6 @@ import email.utils
 import ldap
 import logging
 import pickle
-import pytz
 import time
 
 import tornado.locale
@@ -377,20 +376,6 @@ class User(base.DataObject):
        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
diff --git a/src/templates/modules/select/timezone.html b/src/templates/modules/select/timezone.html
deleted file mode 100644 (file)
index a7a8a7b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<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>
index 9e44840ec5ae90f3b8950135edd18e66fafbd478..4f2395206e1b14b2450041a44aca911c0f43bd53 100644 (file)
@@ -83,7 +83,6 @@ class Application(tornado.web.Application):
                                "HeadingDate"        : ui_modules.HeadingDateModule,
 
                                "SelectLocale"       : ui_modules.SelectLocaleModule,
-                               "SelectTimezone"     : ui_modules.SelectTimezoneModule,
                        },
                        ui_methods = {
                                "extract_hostname"   : self.extract_hostname,
index 9dd0205b3e696e3ad34993e514c389413ac06583..1822f48995c154ee0f72edc72aa06ad9949ba31e 100644 (file)
@@ -1,7 +1,6 @@
 #!/usr/bin/python
 
 import http.client
-import pytz
 import time
 import tornado.locale
 import tornado.web
@@ -55,20 +54,9 @@ class BaseHandler(tornado.web.RequestHandler):
                """
                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)
index 56def25b26a074a8dd546e26830f2113914f07de..2cd352f54c26ff1b0831b54ebc2263c31f4e655c 100644 (file)
@@ -5,7 +5,6 @@ import math
 import pygments
 import pygments.formatters
 import pygments.lexers
-import pytz
 import re
 import tornado.web
 
@@ -310,10 +309,3 @@ class SelectLocaleModule(UIModule):
        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)