Fixed domain not being set on RSS
This commit is contained in:
parent
183cbd577a
commit
0aee3fd407
3 changed files with 21 additions and 4 deletions
|
@ -504,8 +504,8 @@ class FeedEntry(object):
|
||||||
for cat in self.__atom_category:
|
for cat in self.__atom_category:
|
||||||
rss_cat = {}
|
rss_cat = {}
|
||||||
rss_cat['value'] = cat['label'] if cat.get('label') else cat['term']
|
rss_cat['value'] = cat['label'] if cat.get('label') else cat['term']
|
||||||
if cat.get('schema'):
|
if cat.get('scheme'):
|
||||||
rss_cat['domain'] = cat['schema']
|
rss_cat['domain'] = cat['scheme']
|
||||||
self.__rss_category.append( rss_cat )
|
self.__rss_category.append( rss_cat )
|
||||||
return self.__atom_category
|
return self.__atom_category
|
||||||
|
|
||||||
|
|
|
@ -607,8 +607,8 @@ class FeedGenerator(object):
|
||||||
for cat in self.__atom_category:
|
for cat in self.__atom_category:
|
||||||
rss_cat = {}
|
rss_cat = {}
|
||||||
rss_cat['value'] = cat['label'] if cat.get('label') else cat['term']
|
rss_cat['value'] = cat['label'] if cat.get('label') else cat['term']
|
||||||
if cat.get('schema'):
|
if cat.get('scheme'):
|
||||||
rss_cat['domain'] = cat['schema']
|
rss_cat['domain'] = cat['scheme']
|
||||||
self.__rss_category.append( rss_cat )
|
self.__rss_category.append( rss_cat )
|
||||||
return self.__atom_category
|
return self.__atom_category
|
||||||
|
|
||||||
|
|
|
@ -75,3 +75,20 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||||
assert len(fg.entry()) == 1
|
assert len(fg.entry()) == 1
|
||||||
fg.remove_entry(fe)
|
fg.remove_entry(fe)
|
||||||
assert len(fg.entry()) == 0
|
assert len(fg.entry()) == 0
|
||||||
|
|
||||||
|
def test_categoryHasDomain(self):
|
||||||
|
fg = FeedGenerator()
|
||||||
|
fg.title('some title')
|
||||||
|
fg.link( href='http://www.dontcare.com', rel='alternate' )
|
||||||
|
fg.description('description')
|
||||||
|
fe = fg.add_entry()
|
||||||
|
fe.id('http://lernfunk.de/media/654321/1')
|
||||||
|
fe.title('some title')
|
||||||
|
fe.category([
|
||||||
|
{'term' : 'category',
|
||||||
|
'scheme': 'http://www.somedomain.com/category',
|
||||||
|
'label' : 'Category',
|
||||||
|
}])
|
||||||
|
|
||||||
|
result = fg.rss_str()
|
||||||
|
assert 'domain="http://www.somedomain.com/category"' in result
|
||||||
|
|
Loading…
Reference in a new issue