translationContainerList implementation
This commit is contained in:
parent
48c51c38de
commit
8049f5ed95
|
@ -141,7 +141,9 @@ def export_sense(doc, sense):
|
||||||
|
|
||||||
for example in sense.examples:
|
for example in sense.examples:
|
||||||
example_container = example.export(doc)
|
example_container = example.export(doc)
|
||||||
export_translation_list(doc, example, example_container)
|
translation_container_list = doc.createElement("translationContainerList")
|
||||||
|
export_translation_list(doc, example, translation_container_list)
|
||||||
|
example_container.appendChild(translation_container_list)
|
||||||
example_container_list.appendChild(example_container)
|
example_container_list.appendChild(example_container)
|
||||||
|
|
||||||
return sense_xml
|
return sense_xml
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Example(Data):
|
||||||
return example
|
return example
|
||||||
|
|
||||||
def import_xml(self, example_xml):
|
def import_xml(self, example_xml):
|
||||||
self.translations = from_container_list(example_xml.querySelectorAll("translationContainer"))
|
self.translations = from_container_list(example_xml.querySelectorAll("translationContainerList translationContainer"))
|
||||||
|
|
||||||
if example_xml.hasAttribute("modified"):
|
if example_xml.hasAttribute("modified"):
|
||||||
self.edited = example_xml.getAttribute("modified") == "true"
|
self.edited = example_xml.getAttribute("modified") == "true"
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Sense(Data):
|
||||||
|
|
||||||
self.labels = import_label_list("sense > labelList label", sense_xml)
|
self.labels = import_label_list("sense > labelList label", sense_xml)
|
||||||
self.translations = from_container_list(
|
self.translations = from_container_list(
|
||||||
sense_xml.querySelectorAll("translationContainerList translationContainer"))
|
sense_xml.querySelectorAll('sense > translationContainerList translationContainer'))
|
||||||
for example_xml in sense_xml.querySelectorAll("exampleContainerList exampleContainer"):
|
for example_xml in sense_xml.querySelectorAll("exampleContainerList exampleContainer"):
|
||||||
example = Example()
|
example = Example()
|
||||||
example.import_xml(example_xml)
|
example.import_xml(example_xml)
|
||||||
|
|
|
@ -34,7 +34,6 @@ class Translation(Data):
|
||||||
self.source = ""
|
self.source = ""
|
||||||
self.targetLang = ""
|
self.targetLang = ""
|
||||||
self.audio = ""
|
self.audio = ""
|
||||||
self.explanation = ""
|
|
||||||
self.explanationList = set()
|
self.explanationList = set()
|
||||||
self.tags = []
|
self.tags = []
|
||||||
|
|
||||||
|
@ -82,7 +81,6 @@ class Translation(Data):
|
||||||
# next two are not checked as the also can not be deleted via gui
|
# next two are not checked as the also can not be deleted via gui
|
||||||
# result = result and self.source == ""
|
# result = result and self.source == ""
|
||||||
# result = result and self.targetLang == ""
|
# result = result and self.targetLang == ""
|
||||||
result = result and self.explanation == ""
|
|
||||||
result = result and len(self.explanationList) == 0
|
result = result and len(self.explanationList) == 0
|
||||||
result = result and len(self.tags) == 0
|
result = result and len(self.tags) == 0
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in New Issue
Block a user