Fixed error message printed when error in XML files is detected
authorLaurent Bessard
Fri, 27 Sep 2013 17:48:05 +0200
changeset 1332 ac7d39f4e376
parent 1331 38c5de794e62
child 1333 7f264cc6e75d
child 1334 b0c2c4e1c1f1
Fixed error message printed when error in XML files is detected
CodeFileTreeNode.py
ConfigTreeNode.py
--- a/CodeFileTreeNode.py	Fri Sep 27 16:27:54 2013 +0200
+++ b/CodeFileTreeNode.py	Fri Sep 27 17:48:05 2013 +0200
@@ -90,7 +90,7 @@
                 self.CodeFile, error = self.CodeFileParser.LoadXMLString(codefile_xml)
                 if error is not None:
                     self.GetCTRoot().logger.write_warning(
-                        XMLSyntaxErrorMessage % ((self.CODEFILE_NAME,) + error))
+                        XSDSchemaErrorMessage % ((self.CODEFILE_NAME,) + error))
                 self.CreateCodeFileBuffer(True)
             except Exception, exc:
                 self.GetCTRoot().logger.write_error(_("Couldn't load confnode parameters %s :\n %s") % (CTNName, unicode(exc)))
--- a/ConfigTreeNode.py	Fri Sep 27 16:27:54 2013 +0200
+++ b/ConfigTreeNode.py	Fri Sep 27 17:48:05 2013 +0200
@@ -582,6 +582,8 @@
         if os.path.isfile(methode_name):
             execfile(methode_name)
         
+        ConfNodeName = CTNName if CTNName is not None else self.CTNName()
+        
         # Get the base xml tree
         if self.MandatoryParams:
             try:
@@ -589,11 +591,11 @@
                 self.BaseParams, error = _BaseParamsParser.LoadXMLString(basexmlfile.read())
                 if error is not None:
                     self.GetCTRoot().logger.write_warning(
-                        XSDSchemaErrorMessage % ((CTNName + " BaseParams",) + error))
+                        XSDSchemaErrorMessage % ((ConfNodeName + " BaseParams",) + error))
                 self.MandatoryParams = ("BaseParams", self.BaseParams)
                 basexmlfile.close()
             except Exception, exc:
-                self.GetCTRoot().logger.write_error(_("Couldn't load confnode base parameters %s :\n %s") % (CTNName, unicode(exc)))
+                self.GetCTRoot().logger.write_error(_("Couldn't load confnode base parameters %s :\n %s") % (ConfNodeName, unicode(exc)))
                 self.GetCTRoot().logger.write_error(traceback.format_exc())
         
         # Get the xml tree
@@ -603,13 +605,13 @@
                 obj, error = self.Parser.LoadXMLString(xmlfile.read())
                 if error is not None:
                     self.GetCTRoot().logger.write_warning(
-                        XSDSchemaErrorMessage % ((CTNName,) + error))
+                        XSDSchemaErrorMessage % ((ConfNodeName,) + error))
                 name = obj.getLocalTag()
                 setattr(self, name, obj)
                 self.CTNParams = (name, obj)
                 xmlfile.close()
             except Exception, exc:
-                self.GetCTRoot().logger.write_error(_("Couldn't load confnode parameters %s :\n %s") % (CTNName, unicode(exc)))
+                self.GetCTRoot().logger.write_error(_("Couldn't load confnode parameters %s :\n %s") % (ConfNodeName, unicode(exc)))
                 self.GetCTRoot().logger.write_error(traceback.format_exc())
         
     def LoadChildren(self):