Ejemplo n.º 1
0
    def operateInternal(self):
        smtk.WarningMessage(
            self.log(), 'My string is \"%s\"' %
            self.parameters().findString('my string').value())

        # Return with success
        result = self.createResult(smtk.operation.Operation.Outcome.SUCCEEDED)
        result.findString('my string').setValue(
            self.parameters().findString('my string').value())
        return result
Ejemplo n.º 2
0
    def testLogMessage(self):
        # construct an instance of the logger
        logger = smtk.io.Logger()

        # test a single message of each type (info, debug, warning, error)
        smtk.InfoMessage(logger, "This is an info message")
        smtk.DebugMessage(logger, "This is a debug message")
        smtk.WarningMessage(logger, "This is a warning message")
        smtk.ErrorMessage(logger, "This is an error message")

        # confirm that all of the messages have been stored
        self.assertEqual(logger.numberOfRecords(), 4)

        # check that the debug, warning and error messages contain the file name
        # that triggered the message (this file!)
        for i in range(logger.numberOfRecords()):
            rec = logger.toString(i, True)
            if 'INFO' not in rec:
                self.assertTrue(__file__ in rec)
Ejemplo n.º 3
0
def _addWarning(logger, message):
    smtk.WarningMessage(logger, message)