예제 #1
0
파일: main.py 프로젝트: mcrewson/squib
 def configure_reporter (self):
     try:
         reporter_config = self.config.section('reporter')
     except KeyError:
         self.log.warning('No reporter defined. Falling back to SimpleLogReporter.')
         self.reporter = reporter.SimpleLogReporter(None, self.metrics_recorder)
     else:
         reporter_klass = reporter_config.get('class')
         if reporter_klass is None:
             self.log.warning('No report class defined. Falling back to SimpleLogReporter.')
             self.reporter = reporter.SimpleLogReporter(None, self.metrics_recorder)
         else:
             klass = utility.find_python_object(reporter_klass)
             self.reporter = klass(reporter_config, self.metrics_recorder)
예제 #2
0
파일: oxidizer.py 프로젝트: mcrewson/squib
    def setup (self):

        class OxidizerCallableWrapper (object):
            def __init__ (inself, call, conf):
                inself.call = call
                inself.conf = conf
            def run (inself):
                inself.call(inself.conf)

        klass = self.config.get("class")
        if klass is None:
            raise ConfigError("No class defined for this oxidizer")

        try:
            obj = utility.find_python_object(klass)
        except ImportError, err:
            raise ConfigError("Cannot find the oxidizer object: %s" % klass)