Parcourir la source

fixed 'None' dictionnary

Florian il y a 6 ans
Parent
commit
815d95687b
1 fichiers modifiés avec 2 ajouts et 0 suppressions
  1. 2 0
      plan_gen.py

+ 2 - 0
plan_gen.py

@@ -37,6 +37,8 @@ def rand_person(nodes):
 def create_child(parent_node, child_name, child_attrs=None):
     ''' creates an xml child element and set its attributes '''
     child = etree.SubElement(parent_node, child_name)
+    if child_attrs is None:
+        return child
     for attr, value in child_attrs.items():
         child.set(attr, value)
     return child