Fix pushing to non-existent nodes.

This commit is contained in:
Flancian 2021-01-17 22:03:19 +01:00
parent fcfb6f5147
commit 82fd22b8e8
2 changed files with 5 additions and 2 deletions

View File

@ -111,6 +111,8 @@ def node(node):
# earlier in the list means more highly ranked.
n.subnodes = util.uprank(n.subnodes, users=['agora', 'flancian'])
print("in agora.py: ", n.pushed_subnodes())
search_subnodes = db.search_subnodes(node)
return render_template(

View File

@ -57,7 +57,8 @@ class Graph:
# this used to be even worse :)
try:
nodes = [node for node in G.nodes() if node.wikilink == uri]
return nodes[0]
node = nodes[0]
return node
except (KeyError, IndexError):
# We'll handle 404 in the template, as we want to show backlinks to non-existent nodes.
# Return an empty.
@ -228,7 +229,7 @@ class Node:
# Congratulations! You've gotten to the hackiest place in the [[agora]].
# ...as of the time of writing :)
subnodes = []
if other in self.push_nodes():
if other.wikilink in [n.wikilink for n in self.push_nodes()]:
for subnode in self.subnodes:
# I tried parsing the marko tree but honestly this seemed easier/simpler.
html = render.markdown(subnode.content)