Conversion pipeline: Don't fail if parsing extra css raises an exception. Instead just ignore it.

This commit is contained in:
Kovid Goyal 2010-08-24 11:42:30 -06:00
parent 3f5e5875ea
commit 81b917db42

View File

@ -168,12 +168,18 @@ class Stylizer(object):
item.href))
continue
stylesheets.append(sitem.data)
for x in (extra_css, user_css):
csses = {'extra_css':extra_css, 'user_css':user_css}
for w, x in csses.items():
if x:
text = XHTML_CSS_NAMESPACE + x
stylesheet = parser.parseString(text, href=cssname)
stylesheet.namespaces['h'] = XHTML_NS
stylesheets.append(stylesheet)
try:
text = XHTML_CSS_NAMESPACE + x
stylesheet = parser.parseString(text, href=cssname)
stylesheet.namespaces['h'] = XHTML_NS
stylesheets.append(stylesheet)
except:
self.logger.exception('Failed to parse %s, ignoring.'%w)
self.logger.debug('Bad css: ')
self.logger.debug(x)
rules = []
index = 0
self.stylesheets = set()