From a9c7832da155e37d98d4e26e9ea0bafd74a569aa Mon Sep 17 00:00:00 2001 From: "Schimon Jehudah, Adv." Date: Sun, 14 Jul 2024 12:49:56 +0300 Subject: [PATCH] Python: Fix an error upon iterating for elements of type category (Thank you roughnecks). --- pubsub_to_atom.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pubsub_to_atom.py b/pubsub_to_atom.py index 39ce383..d2261be 100644 --- a/pubsub_to_atom.py +++ b/pubsub_to_atom.py @@ -325,9 +325,9 @@ def generate_atom(iq, link): categories = item_payload.find(namespace + 'category') if isinstance(categories, ET.Element): for category in item_payload.findall(namespace + 'category'): - if not 'term' in category.attrib and not category.attrib['term']: continue - category_term = category.attrib['term'] - ET.SubElement(e_entry, 'category', {'term': category_term}) + if 'term' in category.attrib and category.attrib['term']: + category_term = category.attrib['term'] + ET.SubElement(e_entry, 'category', {'term': category_term}) identifier = item_payload.find(namespace + 'id')