xmlclass/xmlclass.py
changeset 1743 c3c3d1318130
parent 1739 ec153828ded2
child 1744 69dfdb26f600
equal deleted inserted replaced
1742:92932cd370a4 1743:c3c3d1318130
   594     return {
   594     return {
   595         "type": TAG,
   595         "type": TAG,
   596         "extract": ExtractTag,
   596         "extract": ExtractTag,
   597         "generate": GenerateTag,
   597         "generate": GenerateTag,
   598         "initial": lambda: None,
   598         "initial": lambda: None,
   599         "check": lambda x: x == None or infos["minOccurs"] == 0 and value == True
   599         "check": lambda x: x is None or infos["minOccurs"] == 0 and value == True
   600     }
   600     }
   601 
   601 
   602 
   602 
   603 def FindTypeInfos(factory, infos):
   603 def FindTypeInfos(factory, infos):
   604     if isinstance(infos, (UnicodeType, StringType)):
   604     if isinstance(infos, (UnicodeType, StringType)):
  1533                 else:
  1533                 else:
  1534                     instance = getattr(self, parts[0], None)
  1534                     instance = getattr(self, parts[0], None)
  1535                     if instance is None and elements[parts[0]]["minOccurs"] == 0:
  1535                     if instance is None and elements[parts[0]]["minOccurs"] == 0:
  1536                         instance = elements[parts[0]]["elmt_type"]["initial"]()
  1536                         instance = elements[parts[0]]["elmt_type"]["initial"]()
  1537                         setattr(self, parts[0], instance)
  1537                         setattr(self, parts[0], instance)
  1538                     if instance != None:
  1538                     if instance is not None:
  1539                         if len(parts) > 1:
  1539                         if len(parts) > 1:
  1540                             instance.setElementValue(parts[1], value)
  1540                             instance.setElementValue(parts[1], value)
  1541                         else:
  1541                         else:
  1542                             instance.setElementValue(None, value)
  1542                             instance.setElementValue(None, value)
  1543             elif elements.has_key("content"):
  1543             elif elements.has_key("content"):