]> git.ipfire.org Git - pbs.git/commitdiff
web: Remove any old UI methods
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 22 Jan 2025 14:03:58 +0000 (14:03 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 22 Jan 2025 14:03:58 +0000 (14:03 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/web/__init__.py
src/web/base.py

index 8eeae35038e0e3fbb74f6067737ed021d19092a5..e53e21f5f3b484bf6def2e2d3a0a823014536ee2 100644 (file)
@@ -1,15 +1,12 @@
 #!/usr/bin/python
 # encoding: utf-8
 
-import datetime
 import logging
 import tornado.locale
 import tornado.web
-import urllib.parse
 
 from .. import Backend
 from ..constants import *
-from .. import misc
 
 # Import all handlers
 from . import auth
@@ -35,10 +32,6 @@ class Application(tornado.web.Application):
                        login_url = "/login",
                        template_path = TEMPLATESDIR,
                        static_path = STATICDIR,
-                       ui_methods = {
-                               "group"              : self.group,
-                               "make_url"           : self.make_url,
-                       },
                        xsrf_cookies = True,
                        xsrf_cookie_kwargs = {
                                "secure" : True,
@@ -206,21 +199,3 @@ class Application(tornado.web.Application):
                self.backend.launch_background_tasks()
 
                logging.info("Successfully initialied application")
-
-       ## UI methods
-
-       def group(self, handler, *args, **kwargs):
-               return misc.group(*args, **kwargs)
-
-       def make_url(self, url, **kwargs):
-               # Format any query arguments and append them to the URL
-               if kwargs:
-                       # Filter out None
-                       args = { k : kwargs[k] for k in kwargs if kwargs[k] is not None }
-
-                       # Encode into URL format
-                       args = urllib.parse.urlencode(args)
-
-                       url = "%s?%s" % (url, args)
-
-               return url
index e1d4b3c054283fe54a2db1276a90b03c3209730b..4f0857efef920dc30b91d7fc6b98137f4eeabbfa 100644 (file)
@@ -26,7 +26,6 @@ import urllib.parse
 
 from .. import __version__
 from .. import builders
-from .. import misc
 from .. import users
 from ..decorators import *
 
@@ -277,7 +276,7 @@ class BaseHandler(tornado.web.RequestHandler):
                        "datetime" : datetime,
 
                        # Functions
-                       "make_url" : self.application.make_url,
+                       "make_url" : self.make_url,
                }
 
                # Custom Filters
@@ -327,6 +326,21 @@ class BaseHandler(tornado.web.RequestHandler):
 
                return ns
 
+       def make_url(self, url, **kwargs):
+               """
+                       Formats any query arguments and append them to the URL
+               """
+               if kwargs:
+                       # Filter out None
+                       args = { k : kwargs[k] for k in kwargs if kwargs[k] is not None }
+
+                       # Encode into URL format
+                       args = urllib.parse.urlencode(args)
+
+                       url = "%s?%s" % (url, args)
+
+               return url
+
        async def render_string(self, template_name, **kwargs):
                """
                        Generates the given template with the given arguments.