Some reorg.
[librarian.git] / src / librarian / parser.py
index 8adde33..5e2fb08 100644 (file)
@@ -30,7 +30,10 @@ class WLElementLookup(etree.CustomElementClassLookup):
             return
         if namespace:
             return
             return
         if namespace:
             return
-        return WL_ELEMENTS[name]
+        try:
+            return WL_ELEMENTS[name]
+        except KeyError:
+            return
 
 
 parser = etree.XMLParser()
 
 
 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():
             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
 
             
         return data