Rev 218: RSS now deals with jobs for other projects. in http://bzr.daniel-watkins.co.uk/pqm/rss
Daniel Watkins
daniel at daniel-watkins.co.uk
Mon Jul 14 14:47:54 BST 2008
At http://bzr.daniel-watkins.co.uk/pqm/rss
------------------------------------------------------------
revno: 218
revision-id: daniel at daniel-watkins.co.uk-20080714134636-6c6ecxxvyn8eb1ld
parent: daniel at daniel-watkins.co.uk-20080714133523-u7371w090lfug4mz
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: rss
timestamp: Mon 2008-07-14 14:46:36 +0100
message:
RSS now deals with jobs for other projects.
-------------- next part --------------
=== modified file 'pqm/ui/template.py'
--- a/pqm/ui/template.py 2008-07-10 15:03:33 +0000
+++ b/pqm/ui/template.py 2008-07-14 13:46:36 +0000
@@ -65,10 +65,15 @@
<link></link>
<description></description>
<item tal:repeat="message messages">
- <title><tal:block tal:condition="repeat/message/start">Now Playing: </tal:block><div tal:replace="message/subject" /></title>
- <author tal:content="message/sender"></author>
- <description><div tal:repeat="command message/commands" tal:replace="command" /><tal:block tal:condition="repeat/message/start">\n<div tal:replace="status_text" /></tal:block></description>
- <pubDate tal:content="message/submission_time"></pubDate>
+ <tal:block tal:condition="not: message/other">
+ <title><tal:block tal:condition="repeat/message/start">Now Playing: </tal:block><div tal:replace="message/subject" /></title>
+ <author tal:content="message/sender"></author>
+ <description><div tal:repeat="command message/commands" tal:replace="command" /><tal:block tal:condition="repeat/message/start">\n<div tal:replace="status_text" /></tal:block></description>
+ </tal:block>
+ <tal:block tal:condition="message/other">
+ <title><tal:block tal:condition="repeat/message/start">Now Playing: </tal:block>A request for another project</title>
+ </tal:block>
+ <pubDate tal:content="message/submission_time"></pubDate>
</item>
</channel>
</rss>"""
=== modified file 'pqm/ui/tests/test_twisted.py'
--- a/pqm/ui/tests/test_twisted.py 2008-07-14 13:35:23 +0000
+++ b/pqm/ui/tests/test_twisted.py 2008-07-14 13:46:36 +0000
@@ -296,11 +296,14 @@
class TestRSSUI(UITestCase):
+ def removeBlankLines(self, string):
+ return '\n'.join([l for l in string.split('\n') if not l.isspace()])
+
def testRSS(self):
queue = self.getResource()
request = DummyRequest(['rss.xml'])
result_resource = getChildForRequest(queue, request)
- rss = result_resource.render(request)
+ rss = self.removeBlankLines(result_resource.render(request))
expected = ('<?xml version="1.0" encoding="iso-8859-1"?>\n'
'<rss version="2.0">\n'
' <channel>\n'
@@ -308,20 +311,20 @@
' <link></link>\n'
' <description></description>\n'
' <item>\n'
- ' <title>Now Playing: A request for another project</title>\n'
- ' <pubDate>...</pubDate>\n'
- ' </item>'
- '<item>\n'
- ' <title>A new action</title>\n'
- ' <author>John.Citizen at example.com</author>\n'
- ' <description>Merge archive at example.com/foo--bar--0 unregistered at example.com/bar--foo--1</description>\n'
- ' <pubDate>...</pubDate>\n'
- ' </item>'
- '<item>\n'
- ' <title>A new action</title>\n'
- ' <author>John.Citizen at example.com</author>\n'
- ' <description>Merge archive at example.com/foo--bar--0 archive2 at example.com/bar--foo--2</description>\n'
- ' <pubDate>...</pubDate>\n'
+ ' <title>Now Playing: A request for another project</title>\n'
+ ' <pubDate>...</pubDate>\n'
+ ' </item>'
+ '<item>\n'
+ ' <title>A new action</title>\n'
+ ' <author>John.Citizen at example.com</author>\n'
+ ' <description>Merge archive at example.com/foo--bar--0 unregistered at example.com/bar--foo--1</description>\n'
+ ' <pubDate>...</pubDate>\n'
+ ' </item>'
+ '<item>\n'
+ ' <title>A new action</title>\n'
+ ' <author>John.Citizen at example.com</author>\n'
+ ' <description>Merge archive at example.com/foo--bar--0 archive2 at example.com/bar--foo--2</description>\n'
+ ' <pubDate>...</pubDate>\n'
' </item>\n'
' </channel>\n'
'</rss>')
More information about the bazaar-commits
mailing list