From 5a68e682d902a9d3b7f11dbf3f62ae8c623bb18f Mon Sep 17 00:00:00 2001 From: Lars Kiesow Date: Fri, 24 Jan 2020 17:51:37 +0100 Subject: [PATCH] Make Generator Optional (Atom) This patch makes the field generator optional in Atom, allowing to set an empty string to disable the element in the same way it is disabled in RSS already: ```python # disable generator element fg.generator('') ``` This fixes #89 --- feedgen/feed.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feedgen/feed.py b/feedgen/feed.py index 710aadc..b2a206f 100644 --- a/feedgen/feed.py +++ b/feedgen/feed.py @@ -165,7 +165,7 @@ class FeedGenerator(object): uri = etree.SubElement(contrib, 'uri') uri.text = c.get('uri') - if self.__atom_generator: + if self.__atom_generator and self.__atom_generator.get('value'): generator = etree.SubElement(feed, 'generator') generator.text = self.__atom_generator['value'] if self.__atom_generator.get('uri'):