Prevent {{ url_for_node(...) }} crashing the planet when node doesn't exist.

Now None is returned as URL, and a warning is logged, rather than crashing
with a 500. A situation like this occurs when an activity refers to a
no longer existing node.
This commit is contained in:
2016-10-21 16:00:03 +02:00
parent 7be8e9b967
commit b59fcb5cba
2 changed files with 17 additions and 2 deletions

View File

@@ -593,7 +593,7 @@ def url_for_node(node_id=None, node=None):
log.warning(
'url_for_node(node_id=%r, node=None): Unable to find node.',
node_id)
raise ValueError('Unable to find node %r' % node_id)
raise NotFound('Unable to find node %r' % node_id)
return finders.find_url_for_node(node)