[views/wdoc] do not crash on malconstructed stuff stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Fri, 08 Oct 2010 13:19:07 +0200
branchstable
changeset 6420 4c14be06e557
parent 6419 6aa0bb1c42e2
child 6424 f443a2b8a5c7
[views/wdoc] do not crash on malconstructed stuff
web/views/wdoc.py
--- a/web/views/wdoc.py	Fri Oct 08 13:12:14 2010 +0200
+++ b/web/views/wdoc.py	Fri Oct 08 13:19:07 2010 +0200
@@ -62,9 +62,11 @@
         snode = index[section.attrib['insertbefore']]
         node = snode.parent
         idx = node.getchildren().index(snode)
-    else:
+    elif 'appendto' in section.attrib:
         node = index[section.attrib['appendto']]
         idx = None
+    else:
+        node, idx = None, None
     return node, idx
 
 def build_toc(config):
@@ -79,6 +81,8 @@
         toc = parse(fpath).getroot()
         for section in toc:
             node, idx = get_insertion_point(section, index)
+            if node is None:
+                continue
             if idx is None:
                 node.append(section)
             else: