コード例 #1
0
 def ingredients(self, value):
     for node in self.xml.xpath('./ingredient'):
         node.getparent().remove(node)
     for item in value:
         self.xml.append(
             E.ingredient(
                 code=item.code,
                 amount=item.amount if hasattr(item, 'amount') else '',
                 unit=item.unit if hasattr(item, 'unit') else '',
                 details=item.details if hasattr(item, 'details') else ''))