コード例 #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
ファイル: context.py プロジェクト: AsherBond/staccato
    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)