From 5b1a7bae3c8e56ea9b512dcbba6b8a512304a956 Mon Sep 17 00:00:00 2001 From: Michele Azzolari Date: Wed, 11 Jan 2012 15:48:37 +0100 Subject: Added PuSH capability --- mediagoblin/submit/views.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'mediagoblin/submit/views.py') diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py index dd273c7f..d5aa60fa 100644 --- a/mediagoblin/submit/views.py +++ b/mediagoblin/submit/views.py @@ -20,6 +20,7 @@ from os.path import splitext from cgi import FieldStorage from celery import registry +import urllib,urllib2 from werkzeug.utils import secure_filename @@ -125,6 +126,19 @@ def submit_start(request): # re-raise the exception raise + if mg_globals.app_config["push_enabled"]: + feed_url=request.urlgen( + 'mediagoblin.user_pages.atom_feed', + qualified=True,user=request.user.username) + hubparameters = { + 'hub.mode': 'publish', + 'hub.url': feed_url} + huburl = mg_globals.app_config["push_url"] + hubdata = urllib.urlencode(hubparameters) + hubheaders = {"Content-type": "application/x-www-form-urlencoded"} + hubrequest = urllib2.Request(huburl, hubdata,hubheaders) + hubresponse = urllib2.urlopen(hubrequest) + add_message(request, SUCCESS, _('Woohoo! Submitted!')) return redirect(request, "mediagoblin.user_pages.user_home", -- cgit v1.2.3