Throw some checking aroud the build_doc

0.3.0.dev
Richard Harding 12 years ago
parent ac5ef73e71
commit 2ee2fe9536

@ -7,8 +7,6 @@ LOG = logging.getLogger()
def get_encoding(page):
LOG.info('GET ENCODING')
LOG.info(type(page))
text = re.sub('</?[^>]*>\s*', ' ', page)
enc = 'utf-8'
if not text.strip() or len(text) < 10:

@ -17,8 +17,10 @@ LOG = logging.getLogger()
def build_doc(page):
LOG.info('BUILD DOC')
LOG.info(type(page))
"""Requires that the `page` not be None"""
if page is None:
LOG.error("Page content is None, can't build_doc")
return ''
if isinstance(page, unicode):
page_unicode = page
else:

Loading…
Cancel
Save