-# MediaGoblin -- federated, autonomous media hosting
-# Copyright (C) 2011 MediaGoblin contributors. See AUTHORS.
+# GNU MediaGoblin -- federated, autonomous media hosting
+# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
from mediagoblin import messages, mg_globals
from mediagoblin.db.util import DESCENDING, ObjectId
-from mediagoblin.tools.text import cleaned_markdown_conversion
from mediagoblin.tools.response import render_to_response, render_404, redirect
from mediagoblin.tools.translate import pass_to_ugettext as _
from mediagoblin.tools.pagination import Pagination
comment['media_entry'] = media._id
comment['author'] = request.user._id
comment['content'] = unicode(request.POST['comment_content'])
- comment['content_html'] = cleaned_markdown_conversion(comment['content'])
if not comment['content'].strip():
messages.add_message(
.sort('created', DESCENDING) \
.limit(ATOM_DEFAULT_NR_OF_UPDATED_ITEMS)
- feed = AtomFeed(request.matchdict['user'],
+ """
+ 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_urls"]:
+ for push_url in mg_globals.app_config["push_urls"]:
+ atomlinks.append({
+ 'rel': 'hub',
+ 'href': push_url})
+
+ feed = AtomFeed(
+ "MediaGoblin: Feed for user '%s'" % request.matchdict['user'],
feed_url=request.url,
- url=request.host_url)
+ id='tag:'+request.host+',2011:gallery.user-'+request.matchdict['user'],
+ links=atomlinks)
+
for entry in cursor:
feed.add(entry.get('title'),
- entry.get('description_html'),
+ entry.description_html,
+ id=entry.url_for_self(request.urlgen,qualified=True),
content_type='html',
- author=request.matchdict['user'],
+ author={
+ 'name': entry.get_uploader.username,
+ 'uri': request.urlgen(
+ 'mediagoblin.user_pages.user_home',
+ qualified=True, user=entry.get_uploader.username)},
updated=entry.get('created'),
- url=entry.url_for_self(request.urlgen))
+ links=[{
+ 'href': entry.url_for_self(
+ request.urlgen,
+ qualified=True),
+ 'rel': 'alternate',
+ 'type': 'text/html'}])
return feed.get_response()