]> ToastFreeware Gitweb - philipp/winterrodeln/wradmin.git/commitdiff
Rename wradmin.genshi to wradmin.template_helper.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Wed, 27 Dec 2017 22:31:27 +0000 (22:31 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Wed, 27 Dec 2017 22:31:27 +0000 (22:31 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wradmin/trunk@2768 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wradmin/__init__.py
wradmin/genshi.py [deleted file]
wradmin/template_helper.py [new file with mode: 0644]

index 5a82ba7f984a89e4136069fc7a2c99ff4f34c33e..85e456e4b0c0bd71db76cca811b9acd1b3333dd1 100644 (file)
@@ -4,7 +4,7 @@
 from flask import Flask, send_from_directory, abort, g, render_template
 from sqlalchemy.engine import create_engine
 import wradmin.model
-import wradmin.genshi
+import wradmin.template_helper
 from wradmin.controllers.rodelbahn import RodelbahnController
 from wradmin.controllers.gasthaus import GasthausController
 from wradmin.controllers.bericht import BerichtController
@@ -14,7 +14,7 @@ from wradmin.controllers.coordtool import CoordtoolController
 app = Flask(__name__)
 app.config.from_envvar('WRADMIN_SETTINGS')
 wradmin.model.init_model(create_engine(app.config['DATABASE_URI']))
-app.jinja_env.globals.update(h=wradmin.genshi.PylonsHelper())
+app.jinja_env.globals.update(h=wradmin.template_helper.PylonsHelper())
 
 
 @app.teardown_appcontext
diff --git a/wradmin/genshi.py b/wradmin/genshi.py
deleted file mode 100644 (file)
index 446c315..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-from flask import url_for
-import wrpylib.wrvalidators
-
-
-class PylonsHelper:
-    def url(self, filename=None, controller=None, action=None, **kwargs):
-        if filename is not None and filename.startswith('/'):
-            filename = filename[1:]
-            return url_for('static', filename=filename)
-        if controller == 'rodelbahn':
-            if action == 'index':
-                return url_for('index')
-        return url_for('{}_{}'.format(controller, action), **kwargs)
-
-    def wiki(self, page_title=None):
-        """Creates a link to the specified page in the www.winterrodeln.org wiki"""
-        if page_title is None:
-            page_title = 'Hauptseite'
-        return 'http://www.winterrodeln.org/wiki/' + page_title
-
-    def forum(self, forum=None):
-        """Creates a link to the specified forum. If no id is given, a general link is created."""
-        if forum is None:
-            return 'http://winterrodeln-forum.org/'
-        return 'http://winterrodeln-forum.org/viewforum.php?f={}'.format(forum)
-
-    def google_maps(self, latitude, longitude):
-        """Builds an URL like http://maps.google.at/maps?q=47.200607,11.260007"""
-        return "http://maps.google.at/maps?q=%.6f,%.6f" % (latitude, longitude)
-
-    def bool(self, value):
-        """Takes a bool value and creates a German representation"""
-        return wrpylib.wrvalidators.opt_bool_german_to_str(value)
-
-    def tristate_tuple(self, yes, no):
-        """Takes a German representation of a tristate value"""
-        return {(True, True): 'Teilweise', (True, False): 'Ja', (False, True): 'Nein'}.get((yes, no), None)
-
-    def tristate_float(self, value):
-        """Takes a German representation of a tristate value"""
-        return wrpylib.wrvalidators.opt_tristate_german_to_str(value)
-
-    def public_transport(self, value):
-        return wrpylib.wrvalidators.opt_public_transport_german_to_str(value)
diff --git a/wradmin/template_helper.py b/wradmin/template_helper.py
new file mode 100644 (file)
index 0000000..446c315
--- /dev/null
@@ -0,0 +1,44 @@
+from flask import url_for
+import wrpylib.wrvalidators
+
+
+class PylonsHelper:
+    def url(self, filename=None, controller=None, action=None, **kwargs):
+        if filename is not None and filename.startswith('/'):
+            filename = filename[1:]
+            return url_for('static', filename=filename)
+        if controller == 'rodelbahn':
+            if action == 'index':
+                return url_for('index')
+        return url_for('{}_{}'.format(controller, action), **kwargs)
+
+    def wiki(self, page_title=None):
+        """Creates a link to the specified page in the www.winterrodeln.org wiki"""
+        if page_title is None:
+            page_title = 'Hauptseite'
+        return 'http://www.winterrodeln.org/wiki/' + page_title
+
+    def forum(self, forum=None):
+        """Creates a link to the specified forum. If no id is given, a general link is created."""
+        if forum is None:
+            return 'http://winterrodeln-forum.org/'
+        return 'http://winterrodeln-forum.org/viewforum.php?f={}'.format(forum)
+
+    def google_maps(self, latitude, longitude):
+        """Builds an URL like http://maps.google.at/maps?q=47.200607,11.260007"""
+        return "http://maps.google.at/maps?q=%.6f,%.6f" % (latitude, longitude)
+
+    def bool(self, value):
+        """Takes a bool value and creates a German representation"""
+        return wrpylib.wrvalidators.opt_bool_german_to_str(value)
+
+    def tristate_tuple(self, yes, no):
+        """Takes a German representation of a tristate value"""
+        return {(True, True): 'Teilweise', (True, False): 'Ja', (False, True): 'Nein'}.get((yes, no), None)
+
+    def tristate_float(self, value):
+        """Takes a German representation of a tristate value"""
+        return wrpylib.wrvalidators.opt_tristate_german_to_str(value)
+
+    def public_transport(self, value):
+        return wrpylib.wrvalidators.opt_public_transport_german_to_str(value)