Fix issue 5367 Edit view updates
[mediagoblin.git] / mediagoblin / listings / views.py
index f92c07059197c8f5b9602d05e343dd1bf972af5d..f640cc9521281ee748ca7215cd2e727bb5d99558 100644 (file)
@@ -14,6 +14,7 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+from mediagoblin import mg_globals
 from mediagoblin.db.models import MediaEntry
 from mediagoblin.db.util import media_entries_for_tag_slug
 from mediagoblin.tools.pagination import Pagination
@@ -74,12 +75,23 @@ def atom_feed(request):
         cursor = media_entries_for_tag_slug(request.db, tag_slug)
         link = request.urlgen('mediagoblin.listings.tags_listing',
                               qualified=True, tag=tag_slug )
-        feed_title += "for tag '%s'" % tag_slug,
+        feed_title += "for tag '%s'" % tag_slug
     else: # all recent item feed
         cursor = MediaEntry.query.filter_by(state=u'processed')
         link = request.urlgen('index', qualified=True)
         feed_title += "for all recent items"
 
+    atomlinks = [
+        {'href': link,
+         '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})
+
     cursor = cursor.order_by(MediaEntry.created.desc())
     cursor = cursor.limit(ATOM_DEFAULT_NR_OF_UPDATED_ITEMS)
 
@@ -87,18 +99,17 @@ def atom_feed(request):
         feed_title,
         feed_url=request.url,
         id=link,
-        links=[{'href': link,
-            'rel': 'alternate',
-            'type': 'text/html'}])
+        links=atomlinks)
+
     for entry in cursor:
         feed.add(entry.get('title'),
             entry.description_html,
             id=entry.url_for_self(request.urlgen,qualified=True),
             content_type='html',
-            author={'name': entry.get_uploader.username,
+            author={'name': entry.get_actor.username,
                 'uri': request.urlgen(
                     'mediagoblin.user_pages.user_home',
-                    qualified=True, user=entry.get_uploader.username)},
+                    qualified=True, user=entry.get_actor.username)},
             updated=entry.get('created'),
             links=[{
                 'href':entry.url_for_self(