ConfigTreeNode.py
changeset 741 382b2c848dac
parent 738 413946c04c87
child 742 41a4a560406c
child 743 4645a3a398ad
equal deleted inserted replaced
740:cee825fbe9b3 741:382b2c848dac
   545                 basexmlfile = open(self.ConfNodeBaseXmlFilePath(CTNName), 'r')
   545                 basexmlfile = open(self.ConfNodeBaseXmlFilePath(CTNName), 'r')
   546                 basetree = minidom.parse(basexmlfile)
   546                 basetree = minidom.parse(basexmlfile)
   547                 self.MandatoryParams[1].loadXMLTree(basetree.childNodes[0])
   547                 self.MandatoryParams[1].loadXMLTree(basetree.childNodes[0])
   548                 basexmlfile.close()
   548                 basexmlfile.close()
   549             except Exception, exc:
   549             except Exception, exc:
   550                 self.GetCTRoot().logger.write_error(_("Couldn't load confnode base parameters %s :\n %s") % (CTNName, str(exc)))
   550                 self.GetCTRoot().logger.write_error(_("Couldn't load confnode base parameters %s :\n %s") % (CTNName, unicode(exc)))
   551                 self.GetCTRoot().logger.write_error(traceback.format_exc())
   551                 self.GetCTRoot().logger.write_error(traceback.format_exc())
   552         
   552         
   553         # Get the xml tree
   553         # Get the xml tree
   554         if self.CTNParams:
   554         if self.CTNParams:
   555             try:
   555             try:
   556                 xmlfile = open(self.ConfNodeXmlFilePath(CTNName), 'r')
   556                 xmlfile = open(self.ConfNodeXmlFilePath(CTNName), 'r')
   557                 tree = minidom.parse(xmlfile)
   557                 tree = minidom.parse(xmlfile)
   558                 self.CTNParams[1].loadXMLTree(tree.childNodes[0])
   558                 self.CTNParams[1].loadXMLTree(tree.childNodes[0])
   559                 xmlfile.close()
   559                 xmlfile.close()
   560             except Exception, exc:
   560             except Exception, exc:
   561                 self.GetCTRoot().logger.write_error(_("Couldn't load confnode parameters %s :\n %s") % (CTNName, str(exc)))
   561                 self.GetCTRoot().logger.write_error(_("Couldn't load confnode parameters %s :\n %s") % (CTNName, unicode(exc)))
   562                 self.GetCTRoot().logger.write_error(traceback.format_exc())
   562                 self.GetCTRoot().logger.write_error(traceback.format_exc())
   563         
   563         
   564     def LoadChildren(self):
   564     def LoadChildren(self):
   565         # Iterate over all CTNName@CTNType in confnode directory, and try to open them
   565         # Iterate over all CTNName@CTNType in confnode directory, and try to open them
   566         for CTNDir in os.listdir(self.CTNPath()):
   566         for CTNDir in os.listdir(self.CTNPath()):
   568                CTNDir.count(NameTypeSeparator) == 1:
   568                CTNDir.count(NameTypeSeparator) == 1:
   569                 pname, ptype = CTNDir.split(NameTypeSeparator)
   569                 pname, ptype = CTNDir.split(NameTypeSeparator)
   570                 try:
   570                 try:
   571                     self.CTNAddChild(pname, ptype)
   571                     self.CTNAddChild(pname, ptype)
   572                 except Exception, exc:
   572                 except Exception, exc:
   573                     self.GetCTRoot().logger.write_error(_("Could not add child \"%s\", type %s :\n%s\n")%(pname, ptype, str(exc)))
   573                     self.GetCTRoot().logger.write_error(_("Could not add child \"%s\", type %s :\n%s\n")%(pname, ptype, unicode(exc)))
   574                     self.GetCTRoot().logger.write_error(traceback.format_exc())
   574                     self.GetCTRoot().logger.write_error(traceback.format_exc())
   575 
   575