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 %}