579 def LoadXMLParams(self, CTNName = None): |
580 def LoadXMLParams(self, CTNName = None): |
580 methode_name = os.path.join(self.CTNPath(CTNName), "methods.py") |
581 methode_name = os.path.join(self.CTNPath(CTNName), "methods.py") |
581 if os.path.isfile(methode_name): |
582 if os.path.isfile(methode_name): |
582 execfile(methode_name) |
583 execfile(methode_name) |
583 |
584 |
|
585 ConfNodeName = CTNName if CTNName is not None else self.CTNName() |
|
586 |
584 # Get the base xml tree |
587 # Get the base xml tree |
585 if self.MandatoryParams: |
588 if self.MandatoryParams: |
586 try: |
589 try: |
587 basexmlfile = open(self.ConfNodeBaseXmlFilePath(CTNName), 'r') |
590 basexmlfile = open(self.ConfNodeBaseXmlFilePath(CTNName), 'r') |
588 self.BaseParams = etree.fromstring( |
591 self.BaseParams, error = _BaseParamsParser.LoadXMLString(basexmlfile.read()) |
589 basexmlfile.read(), _BaseParamsParser) |
592 if error is not None: |
|
593 self.GetCTRoot().logger.write_warning( |
|
594 XSDSchemaErrorMessage % ((ConfNodeName + " BaseParams",) + error)) |
590 self.MandatoryParams = ("BaseParams", self.BaseParams) |
595 self.MandatoryParams = ("BaseParams", self.BaseParams) |
591 basexmlfile.close() |
596 basexmlfile.close() |
592 except Exception, exc: |
597 except Exception, exc: |
593 self.GetCTRoot().logger.write_error(_("Couldn't load confnode base parameters %s :\n %s") % (CTNName, unicode(exc))) |
598 self.GetCTRoot().logger.write_error(_("Couldn't load confnode base parameters %s :\n %s") % (ConfNodeName, unicode(exc))) |
594 self.GetCTRoot().logger.write_error(traceback.format_exc()) |
599 self.GetCTRoot().logger.write_error(traceback.format_exc()) |
595 |
600 |
596 # Get the xml tree |
601 # Get the xml tree |
597 if self.CTNParams: |
602 if self.CTNParams: |
598 try: |
603 try: |
599 xmlfile = open(self.ConfNodeXmlFilePath(CTNName), 'r') |
604 xmlfile = open(self.ConfNodeXmlFilePath(CTNName), 'r') |
600 obj = etree.fromstring(xmlfile.read(), self.Parser) |
605 obj, error = self.Parser.LoadXMLString(xmlfile.read()) |
|
606 if error is not None: |
|
607 self.GetCTRoot().logger.write_warning( |
|
608 XSDSchemaErrorMessage % ((ConfNodeName,) + error)) |
601 name = obj.getLocalTag() |
609 name = obj.getLocalTag() |
602 setattr(self, name, obj) |
610 setattr(self, name, obj) |
603 self.CTNParams = (name, obj) |
611 self.CTNParams = (name, obj) |
604 xmlfile.close() |
612 xmlfile.close() |
605 except Exception, exc: |
613 except Exception, exc: |
606 self.GetCTRoot().logger.write_error(_("Couldn't load confnode parameters %s :\n %s") % (CTNName, unicode(exc))) |
614 self.GetCTRoot().logger.write_error(_("Couldn't load confnode parameters %s :\n %s") % (ConfNodeName, unicode(exc))) |
607 self.GetCTRoot().logger.write_error(traceback.format_exc()) |
615 self.GetCTRoot().logger.write_error(traceback.format_exc()) |
608 |
616 |
609 def LoadChildren(self): |
617 def LoadChildren(self): |
610 # Iterate over all CTNName@CTNType in confnode directory, and try to open them |
618 # Iterate over all CTNName@CTNType in confnode directory, and try to open them |
611 for CTNDir in os.listdir(self.CTNPath()): |
619 for CTNDir in os.listdir(self.CTNPath()): |