예제 #1
0
파일: utils.py 프로젝트: buzztroll/staccato
def load_protocol_module(module_name, CONF):
    try:
        protocol_cls = importutils.import_class(module_name)
    except ImportError, ie:
        raise exceptions.StaccatoParameterError(
            "The protocol module %s could not be loaded. %s" %
            (module_name, ie))
예제 #2
0
    def make_context(self, *args, **kwargs):
        """
        Create a context with the given arguments.
        """

        # Determine the context class to use
        ctxcls = context.RequestContext
        if 'context_class' in self.options:
            ctxcls = importutils.import_class(self.options['context_class'])

        return ctxcls(*args, **kwargs)