From 61e39d90e58b8cea5c837d6da5731ab42127c642 Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Mon, 18 Feb 2013 14:41:34 +0100 Subject: [PATCH] Fix errors in collection views When a collection does not exist, render the 404 page. --- mediagoblin/user_pages/views.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py index 811d3578..0225b6d7 100644 --- a/mediagoblin/user_pages/views.py +++ b/mediagoblin/user_pages/views.py @@ -309,6 +309,9 @@ def user_collection(request, page, url_user=None): get_creator=url_user, slug=request.matchdict['collection']).first() + if not collection: + return render_404(request) + cursor = collection.get_collection_items() pagination = Pagination(page, cursor) @@ -515,6 +518,8 @@ def collection_atom_feed(request): collection = Collection.query.filter_by( creator=user.id, slug=request.matchdict['collection']).first() + if not collection: + return render_404(request) cursor = CollectionItem.query.filter_by( collection=collection.id) \ -- 2.25.1