changeset 1000:48ef9599664c

fixes +feed/atom
author Bruno Gola <brunogola@gmail.com>
date Fri, 28 Oct 2011 18:50:36 -0200
parents 1d17af578b3b
children 99d81080b98e
files MoinMoin/apps/feed/_tests/test_feed.py MoinMoin/apps/feed/views.py
diffstat 2 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/feed/_tests/test_feed.py	Fri Oct 28 12:53:32 2011 -0200
+++ b/MoinMoin/apps/feed/_tests/test_feed.py	Fri Oct 28 18:50:36 2011 -0200
@@ -7,6 +7,8 @@
 
 from MoinMoin._tests import wikiconfig
 
+from MoinMoin.items import Item
+from MoinMoin.config import CONTENTTYPE
 
 class TestFeeds(object):
     class Config(wikiconfig.Config):
@@ -23,3 +25,13 @@
             assert '<feed xmlns="http://www.w3.org/2005/Atom">' in rv.data
             assert '</feed>' in rv.data
 
+    def test_global_atom_with_an_item(self):
+        basename = u'Bar'
+        item = Item.create(basename)
+        item._save({CONTENTTYPE: u'text/plain;charset=utf-8'}, "foo data for feed item")
+        with self.app.test_client() as c:
+            rv = c.get('/+feed/atom')
+            assert rv.status == '200 OK'
+            assert rv.headers['Content-Type'] == 'application/atom+xml'
+            assert rv.data.startswith('<?xml')
+            assert "foo data for feed item" in rv.data
--- a/MoinMoin/apps/feed/views.py	Fri Oct 28 12:53:32 2011 -0200
+++ b/MoinMoin/apps/feed/views.py	Fri Oct 28 18:50:36 2011 -0200
@@ -25,13 +25,14 @@
 from MoinMoin import wikiutil
 from MoinMoin.i18n import _, L_, N_
 from MoinMoin.apps.feed import feed
-from MoinMoin.config import NAME, NAME_EXACT, WIKINAME, ACL, ACTION, ADDRESS, HOSTNAME, USERID, COMMENT, MTIME, REVID, ALL_REVS
+from MoinMoin.config import (NAME, NAME_EXACT, WIKINAME, ACL, ACTION, ADDRESS,
+                            HOSTNAME, USERID, COMMENT, MTIME, REVID, ALL_REVS,
+                            PARENTID)
 from MoinMoin.themes import get_editor_info
 from MoinMoin.items import Item
 from MoinMoin.util.crypto import cache_key
 from MoinMoin.util.interwiki import url_for_item
 
-
 @feed.route('/atom/<itemname:item_name>')
 @feed.route('/atom', defaults=dict(item_name=''))
 def atom(item_name):
@@ -75,7 +76,7 @@
                      content=content, content_type=content_type,
                      author=get_editor_info(rev.meta, external=True),
                      url=url_for_item(name, rev=this_revid, _external=True),
-                     updated=rev.meta[MTIME],
+                     updated=datetime.fromtimestamp(rev.meta[MTIME]),
                     )
         content = feed.to_string()
         app.cache.set(cid, content)