changeset 72:c7bbd3805509

myrss: handle missing item links case
author paulo
date Fri, 08 Jan 2016 23:49:53 -0800
parents 6318de36e334
children 7fa40181ad24
files myrss/myrss_app.py myrss/myrss_test_feed.py
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/myrss/myrss_app.py	Wed Oct 28 00:57:23 2015 -0700
     1.2 +++ b/myrss/myrss_app.py	Fri Jan 08 23:49:53 2016 -0800
     1.3 @@ -141,7 +141,13 @@
     1.4  			if i > 0:
     1.5  				p += " - "
     1.6  
     1.7 -			p.a(_strip_html(it_title), href=it_link, klass="z%d" % (link_z % MAX_LINK_Z))
     1.8 +			if not it_title:
     1.9 +				it_title = "(missing title)"
    1.10 +			if it_link is not None:
    1.11 +				p.a(_strip_html(it_title), href=it_link, klass="z%d" % (link_z % MAX_LINK_Z))
    1.12 +			else:
    1.13 +				p += _strip_html(it_title)
    1.14 +        
    1.15  			link_z += 1
    1.16  
    1.17  	dtdelta = datetime.datetime.now() - dtnow
     2.1 --- a/myrss/myrss_test_feed.py	Wed Oct 28 00:57:23 2015 -0700
     2.2 +++ b/myrss/myrss_test_feed.py	Fri Jan 08 23:49:53 2016 -0800
     2.3 @@ -3,7 +3,7 @@
     2.4  import myrss_app
     2.5  
     2.6  
     2.7 -x = myrss_app._process_feed(open("rottentomatoes.rss.xml"))
     2.8 +x = myrss_app._process_feed(open("yahoo_blogs.rss.xml"))
     2.9  y = myrss_app._to_html(datetime.datetime.now(), [x])
    2.10  
    2.11  print y