diff --git a/scripts/add-ons/export-xml.py b/scripts/add-ons/export-xml.py index 848803f40..00be9d0b3 100755 --- a/scripts/add-ons/export-xml.py +++ b/scripts/add-ons/export-xml.py @@ -36,26 +36,26 @@ command = "/usr/local/bin/task _query " + " ".join (sys.argv[1:]) # Generate output. print "" for task in commands.getoutput (command).split (",\n"): - data = json.loads (task) - print " " - for attribute in data.items (): - if attribute[0] == "annotations": - print " " - for anno in attribute[1]: - print " " - for item in anno.items (): - print " <{0}>{1}".format (item[0], item[1]) - print " " - print " " - elif attribute[0] == "tags": - print " " - for tag in attribute[1]: - print " {0}".format (tag) - print " " - else: - print " <{0}>{1}".format (attribute[0], attribute[1]) - print " " -print "" + data = json.loads (task) + print (" ") + for name,value in data.items (): + if name == "annotations": + print (" ") + for anno in value: + print (" ") + for name,value in anno.items (): + print (" <{0}>{1}".format (name, value)) + print (" ") + print (" ") + elif name == "tags": + print (" ") + for tag in value: + print (" {0}".format (tag)) + print (" ") + else: + print (" <{0}>{1}".format (name, value)) + print (" ") +print ("") sys.exit (0) ################################################################################