template indt

This commit is contained in:
gauthiier
2019-12-27 15:30:07 +01:00
parent c738d324fa
commit 51a55d1968
7 changed files with 642 additions and 602 deletions
+6 -4
View File
@@ -1,4 +1,4 @@
import json, os
import json, os, logging
import xml.etree.ElementTree as et
import export.utils
import config
@@ -14,11 +14,13 @@ def export_generate_path(tag):
now = datetime.now()
return os.path.join(config.export['path'], tag + "_[now].xml")
def emit_mail_xml(msg, xmlel):
def emit_mail_xml(msg, li, xmlel):
global nn
nn += 1
logging.info("export xml: " + li)
mail = et.SubElement(xmlel, 'mail')
subject = et.SubElement(mail, 'subject')
@@ -44,7 +46,7 @@ def emit_mail_xml(msg, xmlel):
followups = export.utils.index_follow_up(msg)
followups.sort(key=lambda tup: tup[0])
for d, f in followups:
emit_mail_xml(f, xmlel)
emit_mail_xml(f, li, xmlel)
#------------------------------------------------------------
@@ -69,7 +71,7 @@ def export_single_tag(t, sel, fout):
chapter_mails = et.SubElement(chapter, 'mails')
for m in ch['lists']:
emit_mail_xml(m, chapter_mails)
emit_mail_xml(m, m['list'], chapter_mails)
fout.write(export.utils.remove_invalid_xml_characters(et.tostring(chapter).decode('utf-8', 'ignore')))