From 81f90b2e09d8ac9065b156ae7c8041e9196e892d Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Sun, 6 Mar 2011 16:31:41 +0100 Subject: [PATCH] Check server status before we check the contents of the feed By checking the contents first, we'd get an exception before we got to the status check, and thus generate an incorrect message --- hamnadmin/register/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hamnadmin/register/views.py b/hamnadmin/register/views.py index 6ad42e0..1c00e50 100644 --- a/hamnadmin/register/views.py +++ b/hamnadmin/register/views.py @@ -70,6 +70,8 @@ def new(request): try: feed = feedparser.parse(feedurl) status = feed.status + if not status == 200: + raise pExcept('Attempt to download blog feed returned status %s.' % (status)) lnk = feed.feed.link l = len(feed.entries) if l < 1: @@ -78,8 +80,6 @@ def new(request): raise except Exception, e: raise pExcept('Failed to download blog feed: %s' % e) - if not status == 200: - raise pExcept('Attempt to download blog feed returned status %s.' % (status)) if not settings.NOTIFYADDR: raise pExcept('Notify address not specified, cannot complete') -- 2.39.5