def convert(self, value, param, ctx): try: return load(value) except AttributeError: self.fail('Could not load module attribute: %s' % value, param, ctx) except ImportError: self.fail('Could not import module: %s' % value, param, ctx) except ValueError: self.fail('Invalid module path: %s' % value, param, ctx)
def configure(configuration): return functools.partial( load(configuration['path']).configure, configuration.get('configuration', {}), )