diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2018-05-29 22:02:37 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2018-05-29 22:28:56 -0400 |
commit | 3eb859974d4a5582fefb978916d1b60c7d3adc27 (patch) | |
tree | adc8d05053d6cb7a70d850d6a2c5399238a6909b /cherrypy | |
parent | ee38ef37252e6604e95e8e56eeab7e025e14bfa0 (diff) | |
download | cherrypy-git-3eb859974d4a5582fefb978916d1b60c7d3adc27.tar.gz |
Just open the file using io module. Decode as locale.getpreferredencoding (default).
Diffstat (limited to 'cherrypy')
-rw-r--r-- | cherrypy/_cperror.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cherrypy/_cperror.py b/cherrypy/_cperror.py index 9c65bff0..f55eed92 100644 --- a/cherrypy/_cperror.py +++ b/cherrypy/_cperror.py @@ -117,6 +117,7 @@ Note that you have to explicitly set and not simply return an error message as a result. """ +import io import contextlib from sys import exc_info as _exc_info from traceback import format_exception as _format_exception @@ -532,7 +533,7 @@ def get_error_page(status, **kwargs): return result else: # Load the template from this path. - template = tonative(open(error_page, 'rb').read()) + template = io.open(error_page, newline='').read() except Exception: e = _format_exception(*_exc_info())[-1] m = kwargs['message'] |