diff --git a/feedgen/entry.py b/feedgen/entry.py index bf50357..d618ebf 100644 --- a/feedgen/entry.py +++ b/feedgen/entry.py @@ -104,7 +104,7 @@ class FeedEntry(object): xmlns="http://www.w3.org/1999/xhtml">%s''' % \ self.__atom_content.get('content'))) elif type == 'CDATA': - content.text = etree.CDATA(self.__atom_content) + content.text = etree.CDATA(self.__atom_content.get('content')) # Emed the text in escaped form elif not type or type.startswith('text') or type == 'html': content.text = self.__atom_content.get('content') diff --git a/feedgen/tests/test_entry.py b/feedgen/tests/test_entry.py index d2fef27..8e4ca0d 100644 --- a/feedgen/tests/test_entry.py +++ b/feedgen/tests/test_entry.py @@ -92,3 +92,15 @@ class TestSequenceFunctions(unittest.TestCase): result = fg.rss_str() assert b'domain="http://www.somedomain.com/category"' in result + + def test_content_cdata_type(self): + fg = FeedGenerator() + fg.title('some title') + fg.id('http://lernfunk.de/media/654322/1') + fe = fg.add_entry() + fe.id('http://lernfunk.de/media/654322/1') + fe.title('some title') + fe.content('content', type='CDATA') + result = fg.atom_str() + assert b'' in result +