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:52 UTC
[2/2] git commit: [#7218] ticket:554 Make rss feed valid
[#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: