Open smurf-U opened 2 years ago
Trying to figure out how long it takes to process a route and if it is successful or not. By creating dispatch controller wrapper to calculate response time with status code and route info for example:
datas = [] def controller_wrapper(next_caller): route = {} def call(*args, **kw): try: route.update({'start': datetime.now(), 'name': request.route.url}) print('Before handler!') return next_caller(*args, **kw) finally: print('After Handler!') route.update({'end':datetime.now(), 'status': response.get_status()}) datas.append(route) print(":::::response", response.status_code, dir(response)) return call config.get_component('dispatch').register_controller_wrapper(controller_wrapper)
After Register above wrapper, and if one of controller gives exception then it will give status_code value as 200. Which is not accurate.
status_code
200
response.status_code should give 500 rather then None.
response.status_code
500
turbogears2==2.4.3
Describe the bug
Trying to figure out how long it takes to process a route and if it is successful or not. By creating dispatch controller wrapper to calculate response time with status code and route info for example:
After Register above wrapper, and if one of controller gives exception then it will give
status_code
value as200
. Which is not accurate.Expected behaviour
response.status_code
should give500
rather then None.Version
turbogears2==2.4.3