From 7bc586466d087ff50b0c6bbe7cf0aefa43994f60 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 26 Apr 2012 15:58:18 +0530 Subject: [PATCH] ... --- src/calibre/ebooks/oeb/base.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 25002d8674..dc71041caa 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -197,13 +197,7 @@ def rewrite_links(root, link_repl_func, resolve_base_href=False): new = cur[:pos] + new_link + cur[pos+len(link):] el.attrib[attrib] = new - def set_property(v): - if v.CSS_PRIMITIVE_VALUE == v.cssValueType and \ - v.CSS_URI == v.primitiveType: - v.setStringValue(v.CSS_URI, - link_repl_func(v.getStringValue())) - - for el in root.iter(): + for el in root.iter(etree.Element): try: tag = el.tag except UnicodeDecodeError: @@ -227,13 +221,7 @@ def rewrite_links(root, link_repl_func, resolve_base_href=False): except: # Parsing errors are raised by cssutils continue - for p in stext.getProperties(all=True): - v = p.cssValue - if v.CSS_VALUE_LIST == v.cssValueType: - for item in v: - set_property(item) - elif v.CSS_PRIMITIVE_VALUE == v.cssValueType: - set_property(v) + replaceUrls(stext, link_repl_func) repl = stext.cssText.replace('\n', ' ').replace('\r', ' ') if isbytestring(repl):