コード例 #1
0
 def export_game_objects(self, root):
     '''
     Exports the game objects to an XML doc.
     For the record, I hate XML with a passion.
     '''
     levels_elem = ET.SubElement(root, "gamelevels")
     levels_elem.set("count", str(GameLevel.count()))
     for level in GameLevel.all()[1:]:
         level.to_xml(levels_elem)
     corps_elem = ET.SubElement(root, "corporations")
     corps_elem.set("count", str(Corporation.count()))
     for corp in Corporation.all():
         corp.to_xml(corps_elem)
コード例 #2
0
 def export_game_objects(self, root):
     '''
     Exports the game objects to an XML doc.
     For the record, I hate XML with a passion.
     '''
     levels_elem = ET.SubElement(root, "gamelevels")
     levels_elem.set("count", str(GameLevel.count()))
     for level in GameLevel.all()[1:]:
         level.to_xml(levels_elem)
     corps_elem = ET.SubElement(root, "corporations")
     corps_elem.set("count", str(Corporation.count()))
     for corp in Corporation.all():
         corp.to_xml(corps_elem)