Explicitly check if title is None. fixes #22

This fixes #22 which caused all titles to be blank.
pull/24/head
Zach Denton 12 years ago
parent 8aefc6175f
commit 0843d9cdf2

@ -44,7 +44,7 @@ def norm_title(title):
def get_title(doc):
title = doc.find('.//title')
if not title or not title.text:
if title is None or len(title.text) == 0:
return '[no-title]'
return norm_title(title.text)
@ -57,7 +57,7 @@ def add_match(collection, text, orig):
def shorten_title(doc):
title = doc.find('.//title')
if not title or not title.text:
if title is None or len(title.text) == 0:
return ''
title = orig = norm_title(title.text)

Loading…
Cancel
Save