Prevent global 404 on /attract when an activity can't be linked.
This happens when an activity is on a deleted item. This change implies that "someone deleted X" activities aren't going to be shown.
This commit is contained in:
@@ -3,6 +3,7 @@ import logging
|
|||||||
|
|
||||||
from flask import Blueprint, render_template, redirect, url_for
|
from flask import Blueprint, render_template, redirect, url_for
|
||||||
import flask_login
|
import flask_login
|
||||||
|
import werkzeug.exceptions as wz_exceptions
|
||||||
|
|
||||||
from pillar.web.utils import attach_project_pictures
|
from pillar.web.utils import attach_project_pictures
|
||||||
import pillar.web.subquery
|
import pillar.web.subquery
|
||||||
@@ -55,7 +56,7 @@ def index():
|
|||||||
act.project = id_to_proj[act.project]
|
act.project = id_to_proj[act.project]
|
||||||
try:
|
try:
|
||||||
act.link = current_attract.link_for_activity(act)
|
act.link = current_attract.link_for_activity(act)
|
||||||
except ValueError:
|
except (ValueError, wz_exceptions.NotFound):
|
||||||
act.link = None
|
act.link = None
|
||||||
|
|
||||||
return render_template('attract/index.html',
|
return render_template('attract/index.html',
|
||||||
|
Reference in New Issue
Block a user