summaryrefslogtreecommitdiff
path: root/wsgitools/applications.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2012-06-29 09:26:09 +0200
committerHelmut Grohne <helmut@subdivi.de>2012-06-29 19:18:56 +0200
commit3f2f7f72a73caf087066c75d2e2b6e5ed908d34d (patch)
tree712eb5665f708f1361917e57c17e5f15487a705b /wsgitools/applications.py
parent472144ac68188056eb41c9cb198df04b454a1da2 (diff)
downloadwsgitools-3f2f7f72a73caf087066c75d2e2b6e5ed908d34d.tar.gz
fix more bytes related issues not covered by test.py
* applications returned errors as str instead of bytes * filters documentation updated with bytes * various filters expecting str where bytes are passed * escape_string also needs to use bytes.isalnum instead of str.isalnum * middlewares injecting str where bytes are expected
Diffstat (limited to 'wsgitools/applications.py')
-rw-r--r--wsgitools/applications.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/wsgitools/applications.py b/wsgitools/applications.py
index cdaf0ae..dfd8a2f 100644
--- a/wsgitools/applications.py
+++ b/wsgitools/applications.py
@@ -50,7 +50,7 @@ class StaticContent:
assert isinstance(environ, dict)
if environ["REQUEST_METHOD"].upper() not in ["GET", "HEAD"] and \
not self.anymethod:
- resp = "Request method not implemented"
+ resp = b"Request method not implemented"
start_response("501 Not Implemented",
[("Content-length", str(len(resp)))])
return [resp]
@@ -102,7 +102,7 @@ class StaticFile:
assert isinstance(environ, dict)
if environ["REQUEST_METHOD"].upper() not in ["GET", "HEAD"]:
- resp = "Request method not implemented"
+ resp = b"Request method not implemented"
start_response("501 Not Implemented",
[("Content-length", str(len(resp)))])
return [resp]
@@ -121,7 +121,7 @@ class StaticFile:
size = stream.tell()
stream.seek(0)
except IOError:
- resp = "File not found"
+ resp = b"File not found"
start_response("404 File not found",
[("Content-length", str(len(resp)))])
return [resp]