if new_date is set, ensure that new_channel is also set
This commit is contained in:
parent
44dccfb59f
commit
0ed1ee63e1
@ -226,7 +226,7 @@ def template_info(source):
|
|||||||
date = item['new_date']
|
date = item['new_date']
|
||||||
|
|
||||||
if item.has_key('new_channel'):
|
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']
|
del item['new_channel']
|
||||||
else:
|
else:
|
||||||
channel = item['new_channel']
|
channel = item['new_channel']
|
||||||
|
35
tests/data/filter/tmpl/new_channel_date.xml
Normal file
35
tests/data/filter/tmpl/new_channel_date.xml
Normal 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>
|
||||||
|
|
23
tests/data/filter/tmpl/new_date.xml
Normal file
23
tests/data/filter/tmpl/new_date.xml
Normal 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>
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user