From e3cf114c68e43485dd51a16f6e4aff919e442784 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 4 Feb 2011 11:24:58 -0700 Subject: [PATCH] Fix #8756 (WSJ Recipe displays brackets on articles without page metadata) --- resources/recipes/wsj.recipe | 6 +++++- resources/recipes/wsj_free.recipe | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/resources/recipes/wsj.recipe b/resources/recipes/wsj.recipe index 6095ca71c7..f2854e65ca 100644 --- a/resources/recipes/wsj.recipe +++ b/resources/recipes/wsj.recipe @@ -158,7 +158,11 @@ class WallStreetJournal(BasicNewsRecipe): meta = a.find(attrs={'class':'meta_sectionName'}) if meta is not None: meta.extract() - title = self.tag_to_string(a).strip() + ' [%s]'%self.tag_to_string(meta) + meta = self.tag_to_string(meta).strip() + if meta: + title = self.tag_to_string(a).strip() + ' [%s]'%meta + else: + title = self.tag_to_string(a).strip() url = 'http://online.wsj.com'+a['href'] desc = '' for p in container.findAll('p'): diff --git a/resources/recipes/wsj_free.recipe b/resources/recipes/wsj_free.recipe index bc16a8de3b..dd42fb5540 100644 --- a/resources/recipes/wsj_free.recipe +++ b/resources/recipes/wsj_free.recipe @@ -140,7 +140,11 @@ class WallStreetJournal(BasicNewsRecipe): meta = a.find(attrs={'class':'meta_sectionName'}) if meta is not None: meta.extract() - title = self.tag_to_string(a).strip() + ' [%s]'%self.tag_to_string(meta) + meta = self.tag_to_string(meta).strip() + if meta: + title = self.tag_to_string(a).strip() + ' [%s]'%meta + else: + title = self.tag_to_string(a).strip() url = 'http://online.wsj.com'+a['href'] desc = '' for p in container.findAll('p'):