From 1255f81cfdb97c782c49d7420cd92fcf1c9b573a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 9 Oct 2016 12:37:12 +0530 Subject: [PATCH] Micro-optimization --- src/calibre/ebooks/oeb/base.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 253fe71735..582548c9ae 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -122,11 +122,11 @@ def iterlinks(root, find_links_in_css=True): for el in root.iter(): attribs = el.attrib try: - tag = el.tag - except UnicodeDecodeError: + tag = barename(el.tag).lower() + except Exception: continue - if tag == XHTML('object'): + if tag == 'object': codebase = None # tags have attributes that are relative to # codebase @@ -152,7 +152,7 @@ def iterlinks(root, find_links_in_css=True): if not find_links_in_css: continue - if tag == XHTML('style') and el.text: + if tag == 'style' and el.text: for match in _css_url_re.finditer(el.text): yield (el, None, match.group(1), match.start(1)) for match in _css_import_re.finditer(el.text):