From fc0dfd8f2cee275511164490ddf14a181770437a Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Sun, 16 May 2010 18:32:31 +0100 Subject: [PATCH] Show error message instead of 500 when reddit is unavailable --- hr/views.py | 7 ++++++- templates/hr/applications/view.html | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/hr/views.py b/hr/views.py index 62440b6..c7768a0 100644 --- a/hr/views.py +++ b/hr/views.py @@ -70,7 +70,12 @@ def view_application(request, applicationid): posts = [] for acc in redditacc: - posts.extend(acc.recent_posts()) + try: + accposts = acc.recent_posts() + except: + reddit_error = "Encountered a error while trying to get all Reddit posts" + accposts = [] + posts.extend(accposts) return render_to_response('hr/applications/view.html', locals(), context_instance=RequestContext(request)) diff --git a/templates/hr/applications/view.html b/templates/hr/applications/view.html index c30e544..f43df89 100644 --- a/templates/hr/applications/view.html +++ b/templates/hr/applications/view.html @@ -74,6 +74,9 @@

Reddit Posts