# Cookie stuff
csrf_cookie_name = string(default='mediagoblin_csrftoken')
+# Push stuff
+push_enabled = boolean(default=True)
+push_url = string(default='https://pubsubhubbub.appspot.com/')
[storage:publicstore]
storage_class = string(default="mediagoblin.storage.filestorage:BasicFileStorage")
from cgi import FieldStorage
from celery import registry
+import urllib,urllib2
from werkzeug.utils import secure_filename
# 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",
"""
ATOM feed id is a tag URI (see http://en.wikipedia.org/wiki/Tag_URI)
"""
+ atomlinks = [{
+ 'href': request.urlgen(
+ 'mediagoblin.user_pages.user_home',
+ qualified=True,user=request.matchdict['user']),
+ 'rel': 'alternate',
+ 'type': 'text/html'
+ }];
+ if mg_globals.app_config["push_enabled"]:
+ atomlinks.append({
+ 'rel': 'hub',
+ 'href': mg_globals.app_config["push_url"]})
+
feed = AtomFeed(
"MediaGoblin: Feed for user '%s'" % request.matchdict['user'],
feed_url=request.url,
id='tag:'+request.host+',2011:gallery.user-'+request.matchdict['user'],
- links=[{
- 'href': request.urlgen(
- 'mediagoblin.user_pages.user_home',
- qualified=True,user=request.matchdict['user']),
- 'rel': 'alternate',
- 'type': 'text/html'}])
+ links=atomlinks)
+
for entry in cursor:
feed.add(entry.get('title'),