From 235f646d3cd2a82682832bce3bea657dd7a416cc Mon Sep 17 00:00:00 2001 From: Lars Kellogg-Stedman Date: Tue, 29 Oct 2024 16:58:03 -0400 Subject: [PATCH] Fix handling of links in atom feeds The existing code iterated over entry links like this: for link in self.__atom_link or []: link = xml_elem('link', entry, href=link['href']) The first line in the loop overwrites the `link` variable, rendering the rest of the loop a no-op. This commit corrects the situation by creating a new variable rather than overwriting the loop variable. --- feedgen/entry.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/feedgen/entry.py b/feedgen/entry.py index 5dd21c2..0923602 100644 --- a/feedgen/entry.py +++ b/feedgen/entry.py @@ -137,17 +137,17 @@ def atom_entry(self, extensions=True): _add_text_elm(entry, self.__atom_content, 'content') for link in self.__atom_link or []: - link = xml_elem('link', entry, href=link['href']) + linkelm = xml_elem('link', entry, href=link['href']) if link.get('rel'): - link.attrib['rel'] = link['rel'] + linkelm.attrib['rel'] = link['rel'] if link.get('type'): - link.attrib['type'] = link['type'] + linkelm.attrib['type'] = link['type'] if link.get('hreflang'): - link.attrib['hreflang'] = link['hreflang'] + linkelm.attrib['hreflang'] = link['hreflang'] if link.get('title'): - link.attrib['title'] = link['title'] + linkelm.attrib['title'] = link['title'] if link.get('length'): - link.attrib['length'] = link['length'] + linkelm.attrib['length'] = link['length'] _add_text_elm(entry, self.__atom_summary, 'summary')