Merge branch 'issue-59-no-author-name'

This commit is contained in:
Lars Kiesow 2017-10-14 21:23:40 +02:00
commit 5a01d0aa47
No known key found for this signature in database
GPG key ID: 5DAFE8D9C823CE73
2 changed files with 10 additions and 3 deletions

View file

@ -333,11 +333,14 @@ class FeedEntry(object):
self.__atom_author = []
self.__atom_author += ensure_format(author,
set(['name', 'email', 'uri']),
set(['name']))
set())
self.__rss_author = []
for a in self.__atom_author:
if a.get('email'):
if a.get('name'):
self.__rss_author.append('%(email)s (%(name)s)' % a)
else:
self.__rss_author.append('%(email)s' % a)
return self.__atom_author
def content(self, content=None, src=None, type=None):

View file

@ -63,7 +63,11 @@ class TestSequenceFunctions(unittest.TestCase):
fe = self.fg.add_item()
fe.title('qwe')
assert fe.title() == 'qwe'
author = fe.author(name='John Doe', email='jdoe@example.com')[0]
author = fe.author(email='ldoe@example.com')[0]
assert not author.get('name')
assert author.get('email') == 'ldoe@example.com'
author = fe.author(name='John Doe', email='jdoe@example.com',
replace=True)[0]
assert author.get('name') == 'John Doe'
assert author.get('email') == 'jdoe@example.com'
contributor = fe.contributor(name='John Doe', email='jdoe@ex.com')[0]