def verify_custom_hook_classname(classname): # Don't wrap the load_class() in a try/except block; just let the # error propagate back to the caller such that they're given the # maximum amount of information to assist in debugging. from .custom_hook import CustomHook cls = load_class(classname) if not isinstance(cls(), CustomHook): raise CommandError("custom hook class '%s' does not derive from " "evn.custom_hook.CustomHook" % classname)
def custom_hook_class(self): return load_class(self.custom_hook_classname)