if new_date is set, ensure that new_channel is also set

This commit is contained in:
Sam Ruby 2007-04-09 15:35:24 -04:00
parent 44dccfb59f
commit 0ed1ee63e1
3 changed files with 59 additions and 1 deletions

View File

@ -226,7 +226,7 @@ def template_info(source):
date = item['new_date']
if item.has_key('new_channel'):
if item['new_channel'] == channel:
if item['new_channel'] == channel and not item.has_key('new_date'):
del item['new_channel']
else:
channel = item['new_channel']

View File

@ -0,0 +1,35 @@
<!--
Description: source id
Expect: Items[0]['new_channel'] == 'http://example.com/' and not Items[1].has_key('new_channel') and Items[2]['new_channel'] == 'http://example.org/'
-->
<feed xmlns="http://www.w3.org/2005/Atom">
<entry>
<updated>2004-02-28T18:14:55Z</updated>
<source>
<id>http://example.com/</id>
</source>
</entry>
<entry>
<updated>2004-02-28T14:14:55Z</updated>
<source>
<id>http://example.com/</id>
</source>
</entry>
<entry>
<updated>2004-02-27T14:14:55Z</updated>
<source>
<id>http://example.org/</id>
</source>
</entry>
<entry>
<updated>2004-02-26T14:14:55Z</updated>
<source>
<id>http://example.org/</id>
</source>
</entry>
<planet:source xmlns:planet='http://planet.intertwingly.net/'>
<id>http://example.com/</id>
</planet:source>
</feed>

View File

@ -0,0 +1,23 @@
<!--
Description: source id
Expect: Items[0]['new_date'] == 'February 28, 2004' and not Items[1].has_key('new_date') and Items[2]['new_date'] == 'February 27, 2004' and Items[3]['new_date'] == 'February 26, 2004'
-->
<feed xmlns="http://www.w3.org/2005/Atom">
<entry>
<updated>2004-02-28T18:14:55Z</updated>
</entry>
<entry>
<updated>2004-02-28T14:14:55Z</updated>
</entry>
<entry>
<updated>2004-02-27T14:14:55Z</updated>
</entry>
<entry>
<updated>2004-02-26T14:14:55Z</updated>
</entry>
<planet:source xmlns:planet='http://planet.intertwingly.net/'>
<id>http://example.com/</id>
</planet:source>
</feed>