From f140d01d3eea4c82e3ab1f10600148c4946bcbbc Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Fri, 24 Mar 2017 22:00:47 +0100 Subject: Open static files with mode = 'rb'. This is a more sane mode for our use, and allows the code to work in python 3, which expects bytes. --- pastepy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pastepy.py b/pastepy.py index 3c919a4..23eb40e 100644 --- a/pastepy.py +++ b/pastepy.py @@ -214,7 +214,7 @@ class Paste(object): self.start_response('404 Not Found', [('Content-Type', 'text/html; charset=utf-8'), ('Location', '/')]) return ['asdf'] self.start_response('200 OK', [('Content-Type', mimetypes.guess_type(filename)[0] or 'text/plain; charset=utf-8')]) - return open(filename) + return open(filename, 'rb') def __call__(self, environ, start_response): self.environ = environ -- cgit v1.2.3