You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2014/03/27 23:08:51 UTC
[1/2] git commit: [#7218] ticket:554 Test that rss feed contains self
link
Repository: allura
Updated Branches:
refs/heads/master e2780d6e0 -> e7a513e0e
[#7218] ticket:554 Test that rss feed contains self link
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/e7a513e0
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/e7a513e0
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/e7a513e0
Branch: refs/heads/master
Commit: e7a513e0ef21ec38ce30dc4cb7384e05b0c1792a
Parents: 2ec715d
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Mar 10 08:15:51 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Mar 27 22:08:21 2014 +0000
----------------------------------------------------------------------
ForgeBlog/forgeblog/tests/functional/test_root.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/e7a513e0/ForgeBlog/forgeblog/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/tests/functional/test_root.py b/ForgeBlog/forgeblog/tests/functional/test_root.py
index cfe43c6..63bbb8c 100644
--- a/ForgeBlog/forgeblog/tests/functional/test_root.py
+++ b/ForgeBlog/forgeblog/tests/functional/test_root.py
@@ -17,7 +17,7 @@
import datetime
-from nose.tools import assert_equal
+from nose.tools import assert_equal, assert_in
from ming.orm.ormsession import ThreadLocalORMSession
from mock import patch
@@ -194,6 +194,14 @@ class Test(TestController):
self.app.get('/blog/feed.rss')
self.app.get('/blog/feed.atom')
+ def test_rss_feed_contains_self_link(self):
+ r = self.app.get('/blog/feed.rss')
+ # atom namespace included
+ assert_in('<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">', r)
+ # ...and atom:link points to feed url
+ assert_in('<atom:link href="http://localhost/blog/feed.rss" '
+ 'type="application/rss+xml" rel="self"></atom:link>', r)
+
def test_post_feeds(self):
self._post()
d = self._blog_date()
[2/2] git commit: [#7218] ticket:554 Make rss feed valid
Posted by br...@apache.org.
[#7218] ticket:554 Make rss feed valid
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/2ec715d3
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/2ec715d3
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/2ec715d3
Branch: refs/heads/master
Commit: 2ec715d30320dc342e3a5dfc4b83e40fe8d3c1b6
Parents: e2780d6
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Mar 10 08:02:35 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Mar 27 22:08:21 2014 +0000
----------------------------------------------------------------------
Allura/allura/model/artifact.py | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/2ec715d3/Allura/allura/model/artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index 2f62ca4..2a838a6 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -744,6 +744,23 @@ class AwardGrant(Artifact):
return None
+
+class RssFeed(FG.Rss201rev2Feed):
+ def rss_attributes(self):
+ attrs = super(RssFeed, self).rss_attributes()
+ attrs['xmlns:atom'] = 'http://www.w3.org/2005/Atom'
+ return attrs
+
+ def add_root_elements(self, handler):
+ super(RssFeed, self).add_root_elements(handler)
+ if self.feed['feed_url'] is not None:
+ handler.addQuickElement('atom:link', '', {
+ 'rel': 'self',
+ 'href': self.feed['feed_url'],
+ 'type': 'application/rss+xml',
+ })
+
+
class Feed(MappedClass):
"""
@@ -835,11 +852,12 @@ class Feed(MappedClass):
since=None, until=None, offset=None, limit=None):
"Produces webhelper.feedgenerator Feed"
d = dict(title=title, link=h.absurl(link),
- description=description, language=u'en')
+ description=description, language=u'en',
+ feed_url=request.url)
if feed_type == 'atom':
feed = FG.Atom1Feed(**d)
elif feed_type == 'rss':
- feed = FG.Rss201rev2Feed(**d)
+ feed = RssFeed(**d)
query = defaultdict(dict)
query.update(q)
if since is not None: