aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Azzolari <macno@macno.org>2012-01-17 22:42:36 +0100
committerMichele Azzolari <macno@macno.org>2012-01-17 22:42:36 +0100
commit77b91efcc260cf5f4e7d2b544a02a12c51f45ad4 (patch)
treec923533828a6b8da29aa7a2c581910a8bfb91191
parent6d13314e99c9e6054e5ab15f7f1fa3f51a87627e (diff)
downloadmediagoblin-77b91efcc260cf5f4e7d2b544a02a12c51f45ad4.tar.lz
mediagoblin-77b91efcc260cf5f4e7d2b544a02a12c51f45ad4.tar.xz
mediagoblin-77b91efcc260cf5f4e7d2b544a02a12c51f45ad4.zip
We handle exceptions if PuSH fails
-rw-r--r--mediagoblin/submit/views.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py
index 65243ca1..91498b09 100644
--- a/mediagoblin/submit/views.py
+++ b/mediagoblin/submit/views.py
@@ -21,6 +21,7 @@ from cgi import FieldStorage
from celery import registry
import urllib,urllib2
+import logging
from werkzeug.utils import secure_filename
@@ -131,15 +132,24 @@ def submit_start(request):
'mediagoblin.user_pages.atom_feed',
qualified=True,user=request.user.username)
hubparameters = {
- 'hub.mode': 'publish',
- 'hub.url': feed_url}
+ 'hub.mode': 'publish',
+ 'hub.url': feed_url}
hubdata = urllib.urlencode(hubparameters)
hubheaders = {
"Content-type": "application/x-www-form-urlencoded",
"Connection": "close"}
for huburl in mg_globals.app_config["push_urls"]:
- hubrequest = urllib2.Request(huburl, hubdata,hubheaders)
- hubresponse = urllib2.urlopen(hubrequest)
+ hubrequest = urllib2.Request(huburl, hubdata, hubheaders)
+ try:
+ hubresponse = urllib2.urlopen(hubrequest)
+ except urllib2.HTTPError as exc:
+ # This is not a big issue, the item will be fetched
+ # by the PuSH server next time we hit it
+ logging.getLogger(__name__).warning(
+ "push url %r gave error %r", huburl, exc.code)
+ except urllib2.URLError as exc:
+ logging.getLogger(__name__).warning(
+ "push url %r is unreachable %r", huburl, exc.reason)
add_message(request, SUCCESS, _('Woohoo! Submitted!'))