Content server: When serving OPDS feeds handle html descriptions taht have namespaced attributes. Fixes #7938 (Stanza shows some authors as "catalog is empty")

This commit is contained in:
Kovid Goyal 2011-01-05 15:26:21 -07:00
parent 847422e9b0
commit 51314ce5d8

View File

@ -101,7 +101,19 @@ def html_to_lxml(raw):
root = html.fragment_fromstring(raw)
root.set('xmlns', "http://www.w3.org/1999/xhtml")
raw = etree.tostring(root, encoding=None)
try:
return etree.fromstring(raw)
except:
for x in root.iterdescendants():
remove = []
for attr in x.attrib:
if ':' in attr:
remove.append(attr)
for a in remove:
del x.attrib[a]
raw = etree.tostring(root, encoding=None)
return etree.fromstring(raw)
def CATALOG_ENTRY(item, item_kind, base_href, version, updated,
ignore_count=False, add_kind=False):