From 8a759d773887dbdfb8f5674f0c6ef7ba9651135b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 29 Apr 2010 19:27:53 -0600 Subject: [PATCH] Fix #5337 (Conversion Error / NotImplementedError failure on custom news fetch) --- src/calibre/ebooks/oeb/stylizer.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/calibre/ebooks/oeb/stylizer.py b/src/calibre/ebooks/oeb/stylizer.py index c9f228a091..0557a1f74d 100644 --- a/src/calibre/ebooks/oeb/stylizer.py +++ b/src/calibre/ebooks/oeb/stylizer.py @@ -96,6 +96,8 @@ class CSSSelector(etree.XPath): path = css_to_xpath(css) except UnicodeEncodeError: # Bug in css_to_xpath path = '/' + except NotImplementedError: # Probably a subselect like :hover + path = '/' path = self.LOCAL_NAME_RE.sub(r"local-name() = '", path) etree.XPath.__init__(self, path, namespaces=namespaces) self.css = css @@ -534,6 +536,8 @@ class Style(object): result = base else: result = self._unit_convert(width, base=base) + if isinstance(result, (unicode, str, bytes)): + result = self._profile.width self._width = result return self._width @@ -555,6 +559,8 @@ class Style(object): result = base else: result = self._unit_convert(height, base=base) + if isinstance(result, (unicode, str, bytes)): + result = self._profile.height self._height = result return self._height