1 from flask import Flask, send_from_directory, abort, g, render_template
2 from sqlalchemy.engine import create_engine
4 import wradmin.template_helper
5 from wradmin.controllers.rodelbahn import RodelbahnController
6 from wradmin.controllers.gasthaus import GasthausController
7 from wradmin.controllers.bericht import BerichtController
8 from wradmin.controllers.coordtool import CoordtoolController
12 app.config.from_envvar('WRADMIN_SETTINGS')
13 wradmin.model.init_model(create_engine(app.config['DATABASE_URI']))
14 app.jinja_env.globals.update(h=wradmin.template_helper.PylonsHelper())
17 @app.teardown_appcontext
18 def remove_db_session(error):
19 """Removes the database session at the end of the request."""
20 wradmin.model.meta.Session.remove()
25 return render_template('index.html')
28 @app.route("/rodelbahn/list")
30 return RodelbahnController().list()
33 @app.route("/rodelbahn/view/<int:id>")
34 def rodelbahn_view(id):
35 return RodelbahnController().view(id)
38 @app.route("/rodelbahn/update")
39 def rodelbahn_update():
40 return RodelbahnController().update()
43 @app.route("/rodelbahn/update_regioncache")
44 def rodelbahn_update_regioncache():
45 return RodelbahnController().update_regioncache()
48 @app.route("/bericht/list")
50 return BerichtController().list()
53 @app.route("/bericht/view/<int:id>")
55 return BerichtController().view(id)
58 @app.route("/bericht/change_date_invalid/<int:id>", methods=['POST'])
59 def bericht_change_date_invalid(id):
60 return BerichtController().change_date_invalid(id)
63 @app.route("/gasthaus/list")
65 return GasthausController().list()
68 @app.route("/gasthaus/view/<int:id>")
69 def gasthaus_view(id):
70 return GasthausController().view(id)
73 @app.route("/gasthaus/update")
74 def gasthaus_update():
75 return GasthausController().update()
78 @app.route("/coordtool/index")
79 def coordtool_index():
80 return CoordtoolController().index()
83 @app.route("/coordtool/convert", methods=['POST'])
84 def coordtool_convert():
85 return CoordtoolController().convert()