From fe3bd56b1616ae491428809a1d3cb400457685ef Mon Sep 17 00:00:00 2001 From: Nathan Nifong Date: Tue, 17 Jul 2012 16:29:41 -0700 Subject: [PATCH 1/3] Removed offending code that broke short_title() --- readability/htmls.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/readability/htmls.py b/readability/htmls.py index 49b3a47..21be584 100644 --- a/readability/htmls.py +++ b/readability/htmls.py @@ -56,9 +56,14 @@ def add_match(collection, text, orig): collection.add(text) def shorten_title(doc): - title = doc.find('.//title') - if title is None or len(title.text) == 0: - return '' + + # This seems to always cause the script to throw TypeError or just return "" as the title + # Removing it seems to make the function work again. -nhnifong + # I don't know what it was here for + # + #title = doc.find('.//title') + #if title is None or len(title.text) == 0: + # return '' title = orig = norm_title(title.text) From e880edee718abfb7eb8640272dfd9efb1bcbd09b Mon Sep 17 00:00:00 2001 From: Nathan Nifong Date: Tue, 17 Jul 2012 16:37:25 -0700 Subject: [PATCH 2/3] re-introduced part of the code I removed that defined the title variable, oops --- readability/htmls.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/readability/htmls.py b/readability/htmls.py index 21be584..b50f0a1 100644 --- a/readability/htmls.py +++ b/readability/htmls.py @@ -57,11 +57,12 @@ def add_match(collection, text, orig): def shorten_title(doc): + title = doc.find('.//title') + # This seems to always cause the script to throw TypeError or just return "" as the title # Removing it seems to make the function work again. -nhnifong # I don't know what it was here for # - #title = doc.find('.//title') #if title is None or len(title.text) == 0: # return '' From 77e9707f7f41e7cbc3494cc2b582d3be67f01eea Mon Sep 17 00:00:00 2001 From: Nathan Nifong Date: Wed, 18 Jul 2012 10:48:37 -0700 Subject: [PATCH 3/3] pulled from buriy --- readability/htmls.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/readability/htmls.py b/readability/htmls.py index b50f0a1..49b3a47 100644 --- a/readability/htmls.py +++ b/readability/htmls.py @@ -56,15 +56,9 @@ def add_match(collection, text, orig): collection.add(text) def shorten_title(doc): - title = doc.find('.//title') - - # This seems to always cause the script to throw TypeError or just return "" as the title - # Removing it seems to make the function work again. -nhnifong - # I don't know what it was here for - # - #if title is None or len(title.text) == 0: - # return '' + if title is None or len(title.text) == 0: + return '' title = orig = norm_title(title.text)