Made the module less strict without breaking the atom standart.

This commit is contained in:
Dannieboy 2021-01-01 00:00:01 +01:00
parent 4a254b719b
commit 0a11860e01

View file

@ -121,14 +121,9 @@ class FeedGenerator(object):
if not a.get('name'): if not a.get('name'):
continue continue
author = xml_elem('author', feed) author = xml_elem('author', feed)
name = xml_elem('name', author) for k in a.keys():
name.text = a.get('name') e = xml_elem(k, author)
if a.get('email'): e.text = str(a.get(k))
email = xml_elem('email', author)
email.text = a.get('email')
if a.get('uri'):
uri = xml_elem('uri', author)
uri.text = a.get('uri')
for l in self.__atom_link or []: for l in self.__atom_link or []:
link = xml_elem('link', feed, href=l['href']) link = xml_elem('link', feed, href=l['href'])
@ -530,9 +525,7 @@ class FeedGenerator(object):
if author is not None: if author is not None:
if replace or self.__atom_author is None: if replace or self.__atom_author is None:
self.__atom_author = [] self.__atom_author = []
self.__atom_author += ensure_format(author, self.__atom_author += [author]
set(['name', 'email', 'uri']),
set(['name']))
self.__rss_author = [] self.__rss_author = []
for a in self.__atom_author: for a in self.__atom_author:
if a.get('email'): if a.get('email'):