aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/submit/views.py
diff options
context:
space:
mode:
authorAaron Williamson <aaron@copiesofcopies.org>2012-01-18 20:40:18 -0500
committerAaron Williamson <aaron@copiesofcopies.org>2012-01-18 20:40:18 -0500
commit291e24f3977308514f0227a2402ecd52a80567d5 (patch)
treec5e056d15997bc3f6382a89405f71dc6aface291 /mediagoblin/submit/views.py
parent4225a677cad97825704ee00222c4771d36924c17 (diff)
parent6fc8af3278173a0d1113dc0cf5525c2249f1d0bc (diff)
downloadmediagoblin-291e24f3977308514f0227a2402ecd52a80567d5.tar.lz
mediagoblin-291e24f3977308514f0227a2402ecd52a80567d5.tar.xz
mediagoblin-291e24f3977308514f0227a2402ecd52a80567d5.zip
Merge branch 'mediagoblin-upstream' into feature544_basic_license_data
Diffstat (limited to 'mediagoblin/submit/views.py')
-rw-r--r--mediagoblin/submit/views.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py
index c3f5699e..b91fdb8d 100644
--- a/mediagoblin/submit/views.py
+++ b/mediagoblin/submit/views.py
@@ -20,6 +20,10 @@ from os.path import splitext
from cgi import FieldStorage
from celery import registry
+import urllib,urllib2
+import logging
+
+_log = logging.getLogger(__name__)
from werkzeug.utils import secure_filename
@@ -129,6 +133,30 @@ def submit_start(request):
# re-raise the exception
raise
+ if mg_globals.app_config["push_urls"]:
+ feed_url=request.urlgen(
+ 'mediagoblin.user_pages.atom_feed',
+ qualified=True,user=request.user.username)
+ hubparameters = {
+ '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)
+ 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
+ _log.warning(
+ "push url %r gave error %r", huburl, exc.code)
+ except urllib2.URLError as exc:
+ _log.warning(
+ "push url %r is unreachable %r", huburl, exc.reason)
+
add_message(request, SUCCESS, _('Woohoo! Submitted!'))
return redirect(request, "mediagoblin.user_pages.user_home",