feed: Streamline rel-via title extraction in _process_entry_content()
authorW. Trevor King <wking@tremily.us>
Fri, 15 Mar 2013 11:44:02 +0000 (07:44 -0400)
committerW. Trevor King <wking@tremily.us>
Fri, 15 Mar 2013 11:44:02 +0000 (07:44 -0400)
No functional change here, this just tightens up the Python code for
clarity.

Signed-off-by: W. Trevor King <wking@tremily.us>
rss2email/feed.py

index 68a79f43c6e9eb0108613a6bdedae9ec949e1d5b..a86be3e32dfc9431fe41f98ab93dd11b71ac7b44 100644 (file)
@@ -710,9 +710,7 @@ class Feed (object):
             for elink in getattr(entry, 'links', []):
                 if elink.get('rel', None) == 'via':
                     url = elink['href']
-                    title = url
-                    if elink.get('title', None):
-                        title = elink['title']
+                    title = elink.get('title', url)
                     lines.append('<p>Via <a href="{}">{}</a></p>'.format(
                             url, title))
             lines.extend([
@@ -739,9 +737,7 @@ class Feed (object):
             for elink in getattr(entry, 'links', []):
                 if elink.get('rel', None) == 'via':
                     url = elink['href']
-                    title = url
-                    if elink.get('title', None):
-                        title = elink['title']
+                    title = elink.get('title', url)
                     lines.append('Via: {} {}'.format(title, url))
             content['type'] = 'text/plain'
             content['value'] = '\n'.join(lines)