Rename url to uri in Atom feeds
According to RFC 4287, there is no atom:url element, only atom:uri, so replace occurrences of atom:url with atom:uri for compliance. Also rename variables holding atom:uri from email to uri to better indicate what they actually are.
This commit is contained in:
parent
217e0842d0
commit
9f4431880e
3 changed files with 10 additions and 10 deletions
|
@ -90,8 +90,8 @@ class FeedEntry(object):
|
|||
email = etree.SubElement(author, 'email')
|
||||
email.text = a.get('email')
|
||||
if a.get('uri'):
|
||||
email = etree.SubElement(author, 'url')
|
||||
email.text = a.get('uri')
|
||||
uri = etree.SubElement(author, 'uri')
|
||||
uri.text = a.get('uri')
|
||||
|
||||
if self.__atom_content:
|
||||
content = etree.SubElement(entry, 'content')
|
||||
|
@ -156,8 +156,8 @@ class FeedEntry(object):
|
|||
email = etree.SubElement(contrib, 'email')
|
||||
email.text = c.get('email')
|
||||
if c.get('uri'):
|
||||
email = etree.SubElement(contrib, 'url')
|
||||
email.text = c.get('uri')
|
||||
uri = etree.SubElement(contrib, 'uri')
|
||||
uri.text = c.get('uri')
|
||||
|
||||
if self.__atom_published:
|
||||
published = etree.SubElement(entry, 'published')
|
||||
|
|
|
@ -47,7 +47,7 @@ class FeedGenerator(object):
|
|||
self.__atom_contributor = None
|
||||
self.__atom_generator = {
|
||||
'value' :'python-feedgen',
|
||||
'url' :'http://lkiesow.github.io/python-feedgen',
|
||||
'uri' :'http://lkiesow.github.io/python-feedgen',
|
||||
'version':feedgen.version.version_str } #{value*,uri,version}
|
||||
self.__atom_icon = None
|
||||
self.__atom_logo = None
|
||||
|
@ -124,8 +124,8 @@ class FeedGenerator(object):
|
|||
email = etree.SubElement(author, 'email')
|
||||
email.text = a.get('email')
|
||||
if a.get('uri'):
|
||||
email = etree.SubElement(author, 'url')
|
||||
email.text = a.get('uri')
|
||||
uri = etree.SubElement(author, 'uri')
|
||||
uri.text = a.get('uri')
|
||||
|
||||
for l in self.__atom_link or []:
|
||||
link = etree.SubElement(feed, 'link', href=l['href'])
|
||||
|
@ -159,8 +159,8 @@ class FeedGenerator(object):
|
|||
email = etree.SubElement(contrib, 'email')
|
||||
email.text = c.get('email')
|
||||
if c.get('uri'):
|
||||
email = etree.SubElement(contrib, 'url')
|
||||
email.text = c.get('uri')
|
||||
uri = etree.SubElement(contrib, 'uri')
|
||||
uri.text = c.get('uri')
|
||||
|
||||
if self.__atom_generator:
|
||||
generator = etree.SubElement(feed, 'generator')
|
||||
|
|
|
@ -215,7 +215,7 @@ class TestSequenceFunctions(unittest.TestCase):
|
|||
assert feed.find("{%s}subtitle" % nsAtom).text == self.subtitle
|
||||
assert feed.find("{%s}contributor" % nsAtom).find("{%s}name" % nsAtom).text == self.contributor['name']
|
||||
assert feed.find("{%s}contributor" % nsAtom).find("{%s}email" % nsAtom).text == self.contributor['email']
|
||||
assert feed.find("{%s}contributor" % nsAtom).find("{%s}url" % nsAtom).text == self.contributor['uri']
|
||||
assert feed.find("{%s}contributor" % nsAtom).find("{%s}uri" % nsAtom).text == self.contributor['uri']
|
||||
assert feed.find("{%s}rights" % nsAtom).text == self.copyright
|
||||
|
||||
def test_rssFeedFile(self):
|
||||
|
|
Loading…
Reference in a new issue