diff --git a/app/models.py b/app/models.py index e3b6c1cf499bade69e04947cfa40576eede02672..5c6966ddf61b1559e029d6628042b940531a696c 100644 --- a/app/models.py +++ b/app/models.py @@ -403,17 +403,17 @@ class CorpusFile(db.Model): self.dir, self.filename) element_tree = ET.parse(file) text_node = element_tree.find('text') - text_node.set('address', self.address) + text_node.set('address', self.address if self.address else "NULL") text_node.set('author', self.author) - text_node.set('booktitle', self.booktitle) - text_node.set('chapter', self.chapter) - text_node.set('editor', self.editor) - text_node.set('institution', self.institution) - text_node.set('journal', self.journal) - text_node.set('pages', self.pages) - text_node.set('publisher', self.publisher) + text_node.set('booktitle', self.booktitle if self.booktitle else "NULL") + text_node.set('chapter', self.chapter if self.chapter else "NULL") + text_node.set('editor', self.editor if self.editor else "NULL") + text_node.set('institution', self.institution if self.institution else "NULL") + text_node.set('journal', self.journal if self.journal else "NULL") + text_node.set('pages', self.pages if self.pages else "NULL") + text_node.set('publisher', self.publisher if self.publisher else "NULL") text_node.set('publishing_year', str(self.publishing_year)) - text_node.set('school', self.school) + text_node.set('school', self.school if self.school else "NULL") text_node.set('title', self.title) element_tree.write(file) self.corpus.status = 'unprepared'