diff --git a/roles/developer/build/files/rss.py b/roles/developer/build/files/rss.py old mode 100755 new mode 100644 index 7a8f91620a..294cad1f27 --- a/roles/developer/build/files/rss.py +++ b/roles/developer/build/files/rss.py @@ -1,6 +1,7 @@ #!/usr/bin/python -tt # -*- coding: utf-8 -*- +from __future__ import print_function import codecs import os import sys @@ -35,7 +36,8 @@ for feed in map(feedparser.parse, FedMag):
'): - article_desc = '
%s
' % article_desc + try: + article_desc = '\n'.join(item.description.split('\n')[1:]) + # remove html tags from description + article_desc = re.sub('<[^<]+?>', '', article_desc) + article_desc = re.sub('<', '<', article_desc) + article_desc = re.sub('>', '>', article_desc) + if len(article_desc) > 140: + article_desc = ' '.join(article_desc.split()[0:25]) + '...' + if not article_desc.startswith(''): + article_desc = '
%s
' % article_desc + except AttributeError: + print ('AttributeError. Going to next item') + continue # we got # Tue, 20 Oct 2015 03:28:42 +0000 # But we expect @@ -73,6 +81,9 @@ for feed in map(feedparser.parse, FedMag): HTML += u"""