From 0aee3fd40727582e126fd35cfb3de0b3314e6105 Mon Sep 17 00:00:00 2001 From: Adam Parkin Date: Tue, 27 Oct 2015 08:50:13 -0700 Subject: [PATCH] Fixed domain not being set on RSS --- feedgen/entry.py | 4 ++-- feedgen/feed.py | 4 ++-- feedgen/tests/test_entry.py | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/feedgen/entry.py b/feedgen/entry.py index 09ad9bd..6b7f4ac 100644 --- a/feedgen/entry.py +++ b/feedgen/entry.py @@ -504,8 +504,8 @@ class FeedEntry(object): for cat in self.__atom_category: rss_cat = {} rss_cat['value'] = cat['label'] if cat.get('label') else cat['term'] - if cat.get('schema'): - rss_cat['domain'] = cat['schema'] + if cat.get('scheme'): + rss_cat['domain'] = cat['scheme'] self.__rss_category.append( rss_cat ) return self.__atom_category diff --git a/feedgen/feed.py b/feedgen/feed.py index bfe1717..88fa0fe 100644 --- a/feedgen/feed.py +++ b/feedgen/feed.py @@ -607,8 +607,8 @@ class FeedGenerator(object): for cat in self.__atom_category: rss_cat = {} rss_cat['value'] = cat['label'] if cat.get('label') else cat['term'] - if cat.get('schema'): - rss_cat['domain'] = cat['schema'] + if cat.get('scheme'): + rss_cat['domain'] = cat['scheme'] self.__rss_category.append( rss_cat ) return self.__atom_category diff --git a/feedgen/tests/test_entry.py b/feedgen/tests/test_entry.py index 7b35d60..4fa768e 100644 --- a/feedgen/tests/test_entry.py +++ b/feedgen/tests/test_entry.py @@ -75,3 +75,20 @@ class TestSequenceFunctions(unittest.TestCase): assert len(fg.entry()) == 1 fg.remove_entry(fe) 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