diff --git a/newsroom/news_api/news/syndicate/service.py b/newsroom/news_api/news/syndicate/service.py index b37f99b1..1f4934ff 100644 --- a/newsroom/news_api/news/syndicate/service.py +++ b/newsroom/news_api/news/syndicate/service.py @@ -91,10 +91,14 @@ def generate_atom_feed(response, token=None): SubElement(feed, 'title').text = etree.CDATA('{} Atom Feed'.format(app.config['SITE_NAME'])) SubElement(feed, 'updated').text = __class__._format_update_date(utcnow()) SubElement(SubElement(feed, 'author'), 'name').text = app.config['SITE_NAME'] - SubElement(feed, 'id').text = url_for('syndicate.get_syndicate_feed', syndicate_type='syndicate', _external=True, formatter='atom') + feed_url = url_for('syndicate.get_syndicate_feed', + syndicate_type='syndicate', + _external=True, + formatter='atom') + + SubElement(feed, 'id').text = feed_url SubElement(feed, 'link', - attrib={'href': url_for('syndicate.get_syndicate_feed', syndicate_type='syndicate', _external=True, formatter='atom'), - 'rel': 'self'}) + attrib={'href': feed_url, 'rel': 'self'}) item_resource = get_resource_service('items') image = None for item in response['_items']: @@ -206,7 +210,11 @@ def generate_rss_feed(response, token=None): channel = SubElement(feed, 'channel') SubElement(channel, 'title').text = '{} RSS Feed'.format(app.config['SITE_NAME']) SubElement(channel, 'description').text = '{} RSS Feed'.format(app.config['SITE_NAME']) - SubElement(channel, 'link').text = url_for('syndicate.get_syndicate_feed', syndicate_type='syndicate', _external=True, formatter='rss') + feed_url = url_for('syndicate.get_syndicate_feed', + syndicate_type='syndicate', + _external=True, + formatter='rss') + SubElement(channel, 'link').text = feed_url item_resource = get_resource_service('items') image = None for item in response['_items']: @@ -254,7 +262,7 @@ def generate_rss_feed(response, token=None): 'COPYRIGHT_HOLDER'] SubElement(entry, 'source', - attrib={'url': url_for('syndicate.get_syndicate_feed', syndicate_type='syndicate', _external=True, formatter='rss')}).text = \ + attrib={'url': feed_url}).text = \ complete_item.get('source', '') if complete_item.get('pubstatus') == 'usable':