def dispatch_exception(exception, args, kw): # errorhandling import here to avoid circular imports from gearshift.errorhandling import dispatch_error # Keep in mind func is not the real func but _expose real_func, accept, allow_json, controller = args[:4] args = args[4:] exc_type, exc_value, exc_trace = sys.exc_info() remove_keys(kw, ("tg_source", "tg_errors", "tg_exceptions")) try: output = dispatch_error( controller, real_func, None, exception, *args, **kw) except NoApplicableMethods: raise exc_type, exc_value, exc_trace else: del exc_trace return output
def dispatch_exception(exception, args, kw): # errorhandling import here to avoid circular imports from gearshift.errorhandling import dispatch_error # Keep in mind func is not the real func but _expose real_func, accept, allow_json, controller = args[:4] args = args[4:] exc_type, exc_value, exc_trace = sys.exc_info() remove_keys(kw, ("tg_source", "tg_errors", "tg_exceptions")) try: output = dispatch_error(controller, real_func, None, exception, *args, **kw) except NoApplicableMethods: raise exc_type, exc_value, exc_trace else: del exc_trace return output
def test_remove_keys(): assert util.remove_keys(dict(x=1, y=2, z=3), 'xz') == dict(y=2)