X-Git-Url: https://git.toastfreeware.priv.at/philipp/winterrodeln/wradmin.git/blobdiff_plain/9f9969d09d9b027e93183d2df7de312772954b39..ae4a94a1f054903761d8651f6c255dac8fba192a:/wradmin/controllers/rodelbahn.py diff --git a/wradmin/controllers/rodelbahn.py b/wradmin/controllers/rodelbahn.py index 345cbc1..a4c2a64 100644 --- a/wradmin/controllers/rodelbahn.py +++ b/wradmin/controllers/rodelbahn.py @@ -1,11 +1,12 @@ -from flask import request, abort, redirect, url_for, flash, render_template +from urllib.parse import quote_plus + import paginate import sqlalchemy as sa +from flask import request, abort, redirect, url_for, flash, render_template, current_app -import wrpylib.wrmwmarkup -import wrpylib.wrmwcache import wrpylib.mwmarkup - +import wrpylib.wrmwcache +import wrpylib.wrmwmarkup from wradmin.app import db from wradmin.model import WrSledrunCache, WrReport from wradmin.template_helper import PylonsHelper @@ -40,12 +41,10 @@ class RodelbahnController: sledrun = q.get(sledrun_id) if sledrun is None: abort(404) - h = PylonsHelper() - return render_template('json_editor.html', - schema_url=url_for('static', filename='schema_v1.json'), - #json_url=url_for('static', filename='latschenhuette.json') - json_url=h.wiki(sledrun.page_title) - ) + mediawiki_index = f'{current_app.config["MEDIAWIKI_ROOT"]}/index.php' + schema_url = f'{mediawiki_index}?title=Winterrodeln:Datenschema/Rodelbahn/V1.json&action=raw' + json_url = f'{mediawiki_index}?title={quote_plus(sledrun.page_title)}/Rodelbahn.json&action=raw' + return render_template('json_editor.html', schema_url=schema_url, json_url=json_url) def update(self): """Updates the wrsledruncache table from the wiki"""