From 983ff8d169f1a6133155d28470214ba2975fe177 Mon Sep 17 00:00:00 2001 From: Flancian <0@flancia.org> Date: Sun, 27 Dec 2020 20:19:52 +0100 Subject: [PATCH] Patch. --- app/agora.py | 7 +++++-- app/db.py | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/agora.py b/app/agora.py index 78de67c..631f5ad 100644 --- a/app/agora.py +++ b/app/agora.py @@ -22,6 +22,9 @@ from . import util bp = Blueprint('agora', __name__) +G = db.G + + # Special @bp.route('/index') @bp.route('/') @@ -138,12 +141,12 @@ def garden(garden): # Lists @bp.route('/nodes') def nodes(): - return render_template('nodes.html', nodes=db.all_nodes(include_journals=False)) + return render_template('nodes.html', nodes=G.nodes(include_journals=False)) @bp.route('/notes') # alias @bp.route('/subnodes') def subnodes(): - return render_template('subnodes.html', subnodes=db.all_subnodes()) + return render_template('subnodes.html', subnodes=G.subnodes()) @bp.route('/users') def users(): diff --git a/app/db.py b/app/db.py index e5d6718..9f28d16 100644 --- a/app/db.py +++ b/app/db.py @@ -51,7 +51,7 @@ class Graph: # looks up a node by uri (essentially [[wikilink]]). # horrible nodes = self.nodes() - return [node for node in nodes if node.uri == uri][0] + return nodes_by_wikilink(uri)[0] def nodes(self, include_journals=True): # returns a list of all nodes @@ -287,7 +287,6 @@ def wikilink_to_node(node): # We'll handle 404 in the template, as we want to show backlinks to non-existent nodes. return False - def subnodes_by_wikilink(wikilink, fuzzy_matching=True): if fuzzy_matching: # TODO