summaryrefslogtreecommitdiff
path: root/src/pydrilla
diff options
context:
space:
mode:
Diffstat (limited to 'src/pydrilla')
-rw-r--r--src/pydrilla/pydrilla.py17
-rw-r--r--src/pydrilla/templates/index.html2
2 files changed, 8 insertions, 11 deletions
diff --git a/src/pydrilla/pydrilla.py b/src/pydrilla/pydrilla.py
index 7300198..239267e 100644
--- a/src/pydrilla/pydrilla.py
+++ b/src/pydrilla/pydrilla.py
@@ -634,10 +634,10 @@ j2env = MyEnvironment(loader=PackageLoader(__package__), autoescape=False)
indexpage = j2env.get_template('index.html')
@bp.route('/')
def index():
- return indexpage.render(content=current_app._pydrilla_resources_map)
+ return indexpage.render()
-for item_type in ['resource', 'mapping']:
- def item(identifier):
+for item_type in ['mapping', 'resource']:
+ def item(identifier, item_type=item_type):
ver = request.args.get('ver')
if ver is not None:
try:
@@ -645,12 +645,11 @@ for item_type in ['resource', 'mapping']:
except:
abort(400)
- item = current_app._pydrilla_content\
- .find_item(item_type, identifier, ver)
- if item is None:
+ definition = current_app._pydrilla_content\
+ .find_item(item_type, identifier, ver)
+ if definition is None:
abort(404)
- return json.dumps(item)
+ return json.dumps(definition)
- item.__name__ = item_type + 's'
- bp.route(f'/{item_type}s/<string:identifier>')(item)
+ bp.add_url_rule(f'/{item_type}s/<string:identifier>', item_type, item)
diff --git a/src/pydrilla/templates/index.html b/src/pydrilla/templates/index.html
index 71de8ba..5f5b319 100644
--- a/src/pydrilla/templates/index.html
+++ b/src/pydrilla/templates/index.html
@@ -27,6 +27,4 @@ in a proprietary program, I am not going to enforce this in court.
{% block body %}
{{ super() }}
<h2>{{ _('hydrilla_welcome') }}</h2>
- <h4>content</h4>
- {{ content }}
{% endblock %}