From 25c554fe92c9a66693e925de6f17649a42bdb4bb Mon Sep 17 00:00:00 2001 From: Flancian <0@flancia.org> Date: Mon, 16 Nov 2020 21:15:02 +0100 Subject: [PATCH] Some more light fixes, plus fix the subnode "404". --- app/db.py | 8 ++++++-- app/templates/node_rendered.html | 10 +++++++--- app/templates/subnode_rendered.html | 6 +++++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/db.py b/app/db.py index 9fad9c4..8f9fcdf 100644 --- a/app/db.py +++ b/app/db.py @@ -182,8 +182,12 @@ def subnodes_by_user(user): return subnodes def subnode_by_uri(uri): - subnode = [subnode for subnode in all_subnodes() if subnode.uri == uri][0] - return subnode + subnode = [subnode for subnode in all_subnodes() if subnode.uri == uri] + if subnode: + return subnode[0] + else: + # TODO: handle. + return False def nodes_by_outlink(wikilink): nodes = [node for node in all_nodes() if wikilink in node.outlinks] diff --git a/app/templates/node_rendered.html b/app/templates/node_rendered.html index 5307648..08d1da4 100644 --- a/app/templates/node_rendered.html +++ b/app/templates/node_rendered.html @@ -17,13 +17,16 @@ {% extends "base.html" %} {% block content %} {% if not subnodes %} -No node found for '{{wikilink}}'. +
{% endif %} +{% if subnodes %}