aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/submit/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/submit/views.py')
-rw-r--r--mediagoblin/submit/views.py28
1 files changed, 2 insertions, 26 deletions
diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py
index b52fca33..6d4c8be3 100644
--- a/mediagoblin/submit/views.py
+++ b/mediagoblin/submit/views.py
@@ -20,8 +20,6 @@ import uuid
from os.path import splitext
from celery import registry
-import urllib
-import urllib2
import logging
_log = logging.getLogger(__name__)
@@ -39,6 +37,7 @@ from mediagoblin.processing.task import ProcessMedia
from mediagoblin.messages import add_message, SUCCESS
from mediagoblin.media_types import sniff_media, \
InvalidFileType, FileTypeNotSupported
+from mediagoblin.submit.lib import handle_push_urls
@require_active_login
@@ -134,30 +133,7 @@ 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)
+ handle_push_urls(request)
add_message(request, SUCCESS, _('Woohoo! Submitted!'))