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

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

Loading…
Cancel
Save