diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2019-11-03 07:57:11 -0600 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2019-11-03 07:57:11 -0600 |
| commit | ee8ba6ae1db4a948cb40e2f31d4a4ebeb1286759 (patch) | |
| tree | 9c7c13e8b894ad28eec6a942b16305cc49ca2c10 /cherrypy | |
| parent | 5c5aba49a82bae1db18d19233342b58cc9c45d8f (diff) | |
| download | cherrypy-git-ee8ba6ae1db4a948cb40e2f31d4a4ebeb1286759.tar.gz | |
Inline the getattr operation
Diffstat (limited to 'cherrypy')
| -rw-r--r-- | cherrypy/lib/cpstats.py | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/cherrypy/lib/cpstats.py b/cherrypy/lib/cpstats.py index 622aa09c..7d298bdb 100644 --- a/cherrypy/lib/cpstats.py +++ b/cherrypy/lib/cpstats.py @@ -196,7 +196,7 @@ import time import six import cherrypy -from cherrypy._cpcompat import json, tonative +from cherrypy._cpcompat import json # ------------------------------- Statistics -------------------------------- # @@ -308,14 +308,6 @@ def _get_threading_ident(): return threading._get_ident() -def _get_response_status(resp): - try: - response_status = resp.output_status - except AttributeError: - response_status = resp.status - return tonative(response_status, 'utf-8') - - class StatsTool(cherrypy.Tool): """Record various information about the current request.""" @@ -374,7 +366,7 @@ class StatsTool(cherrypy.Tool): w['Bytes Written'] = cl appstats['Total Bytes Written'] += cl - w['Response Status'] = _get_response_status(resp) + w['Response Status'] = getattr(resp, 'output_status', resp.status) w['End Time'] = time.time() p = w['End Time'] - w['Start Time'] |
