From 1f922ddb5a55272d15b5f6c0aff2eb25bd303421 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 27 Aug 2010 22:32:41 -0600 Subject: [PATCH] Fix bug in HTML Input plugin preprocess code when it is called before __call__ --- src/calibre/ebooks/html/input.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/ebooks/html/input.py b/src/calibre/ebooks/html/input.py index 51c74228b7..d57bfddd3e 100644 --- a/src/calibre/ebooks/html/input.py +++ b/src/calibre/ebooks/html/input.py @@ -491,6 +491,9 @@ class HTMLInput(InputFormatPlugin): return (None, raw) def preprocess_html(self, html): + if not hasattr(self, 'log'): + from calibre.utils.logging import default_log + self.log = default_log self.log("********* Preprocessing HTML *********") # Detect Chapters to match the xpath in the GUI chapdetect = re.compile(r'(?=]*>)?\s*(?P(<(i|b)><(i|b)>|<(i|b)>)?(.?Chapter|Epilogue|Prologue|Book|Part|Dedication)\s*([\d\w-]+(\s\w+)?)?(|)?)(]*>)', re.IGNORECASE)