X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/52de56522d8d29146b3be2266f57ccef0abe417a..eb6b8e8e497922011e8a89f1e1869d68ef8f7066:/src/librarian/parser.py?ds=sidebyside diff --git a/src/librarian/parser.py b/src/librarian/parser.py index 8adde33..bea67b1 100644 --- a/src/librarian/parser.py +++ b/src/librarian/parser.py @@ -30,7 +30,10 @@ class WLElementLookup(etree.CustomElementClassLookup): return if namespace: return - return WL_ELEMENTS[name] + try: + return WL_ELEMENTS[name] + except KeyError: + return parser = etree.XMLParser() @@ -115,7 +118,7 @@ class WLDocument(object): else: data['parts'].append((part, part.get_statistics())) for k, v in data['parts'][-1][1]['total'].items(): - data['total'][k] += v + data['total'][k] = data['total'].get(k, 0) + v return data @@ -178,7 +181,7 @@ class WLDocument(object): for part_uri in self.book_info.parts: try: yield self.from_file( - self.provider.by_uri(part_uri), provider=self.provider + self.provider.by_slug(part_uri.slug), provider=self.provider ) except Exception as e: if pass_part_errors: