From ca69b438391989b913b83e78ace0c34a235cbdbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 10 Nov 2016 11:33:43 +0100 Subject: [PATCH] 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. --- attract/routes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/attract/routes.py b/attract/routes.py index bd1b7f8..0cafded 100644 --- a/attract/routes.py +++ b/attract/routes.py @@ -3,6 +3,7 @@ import logging from flask import Blueprint, render_template, redirect, url_for import flask_login +import werkzeug.exceptions as wz_exceptions from pillar.web.utils import attach_project_pictures import pillar.web.subquery @@ -55,7 +56,7 @@ def index(): act.project = id_to_proj[act.project] try: act.link = current_attract.link_for_activity(act) - except ValueError: + except (ValueError, wz_exceptions.NotFound): act.link = None return render_template('attract/index.html',