コード例 #1
0
ファイル: context.py プロジェクト: jkoelker/openstack-common
    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 = utils.import_class(self.options['context_class'])

        return ctxcls(*args, **kwargs)
コード例 #2
0
 def test_import_class(self):
     dt = utils.import_class('datetime.datetime')
     self.assertEqual(sys.modules['datetime'].datetime, dt)
コード例 #3
0
 def test_import_class(self):
     dt = utils.import_class('datetime.datetime')
     self.assertEqual(sys.modules['datetime'].datetime, dt)