diff options
author | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2012-01-17 18:30:15 +0100 |
---|---|---|
committer | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2012-01-17 18:30:15 +0100 |
commit | 6d13314e99c9e6054e5ab15f7f1fa3f51a87627e (patch) | |
tree | 5672acf3822295a05eb0a5e09b2b5e3fc13fde8c /mediagoblin/submit/views.py | |
parent | 8c7701f9f1653cf4038143cfb7a497ae21edf108 (diff) | |
parent | bb025ebda14297b721f8816d13980a477f62bca6 (diff) | |
download | mediagoblin-6d13314e99c9e6054e5ab15f7f1fa3f51a87627e.tar.lz mediagoblin-6d13314e99c9e6054e5ab15f7f1fa3f51a87627e.tar.xz mediagoblin-6d13314e99c9e6054e5ab15f7f1fa3f51a87627e.zip |
Merge remote branch 'remotes/macno/pushatom'
* remotes/macno/pushatom:
As per spec, we permit to have more then 1 hub
As suggested by Elrond, we use only one setting
Default is now PuSH disabled
Added PuSH capability
Diffstat (limited to 'mediagoblin/submit/views.py')
-rw-r--r-- | mediagoblin/submit/views.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py index dd273c7f..65243ca1 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,21 @@ 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) + hubresponse = urllib2.urlopen(hubrequest) + add_message(request, SUCCESS, _('Woohoo! Submitted!')) return redirect(request, "mediagoblin.user_pages.user_home", |