def write_global_id(self): try: fh = codecs.open(CommonMethods.get_eaxs_filename(), "ab", "utf-8") fh.write(self.get_id()) fh.close() CommonMethods.set_eaxs_file(CommonMethods.get_eaxs_filename()) except FileNotFoundError as e: self.logger.error("{}: {}".format( e, CommonMethods.get_eaxs_filename()))
def render(self): folder = etree.Element("Folder") name = etree.SubElement(folder, "Name") name.text = self.name if len(self.messages) > 0: for mes in self.messages: """ :type mes: DmMessage """ try: mes.render(folder) except AttributeError as e: pass outfile = open(CommonMethods.get_eaxs_filename(), "ab") etree.ElementTree(folder).write(outfile, encoding="utf-8", pretty_print=True) folder = None