diff --git a/src/calibre/ebooks/oeb/stylizer.py b/src/calibre/ebooks/oeb/stylizer.py index a6803854e8..c4301322e8 100644 --- a/src/calibre/ebooks/oeb/stylizer.py +++ b/src/calibre/ebooks/oeb/stylizer.py @@ -17,7 +17,8 @@ from xml.dom import SyntaxErr as CSSSyntaxError import cssutils from cssutils.css import CSSStyleRule, CSSPageRule, CSSStyleDeclaration, \ CSSValueList, cssproperties -from cssutils.profiles import profiles as cssprofiles +from cssutils.profiles import Profiles +cssprofiles = Profiles() from lxml import etree from lxml.cssselect import css_to_xpath, ExpressionError, SelectorSyntaxError from calibre.ebooks.oeb.base import XHTML, XHTML_NS, CSS_MIME, OEB_STYLES diff --git a/src/cssutils/errorhandler.py b/src/cssutils/errorhandler.py index aecf3e5fb1..2d1814b6c8 100644 --- a/src/cssutils/errorhandler.py +++ b/src/cssutils/errorhandler.py @@ -27,7 +27,7 @@ class _ErrorHandler(object): """ handles all errors and log messages """ - def __init__(self, log, defaultloglevel=logging.INFO, + def __init__(self, log, defaultloglevel=logging.INFO, raiseExceptions=True): """ inits log if none given @@ -51,7 +51,7 @@ class _ErrorHandler(object): hdlr.setFormatter(formatter) self._log.addHandler(hdlr) self._log.setLevel(defaultloglevel) - + self.raiseExceptions = raiseExceptions def __getattr__(self, name): @@ -86,7 +86,7 @@ class _ErrorHandler(object): if error and self.raiseExceptions and not neverraise: if isinstance(error, urllib2.HTTPError) or isinstance(error, urllib2.URLError): raise - elif issubclass(error, xml.dom.DOMException): + elif issubclass(error, xml.dom.DOMException): error.line = line error.col = col # raise error(msg, line, col)