Fix more python 3 unicode issues

This commit is contained in:
Andrew Godwin 2016-02-09 13:32:37 -08:00
parent be172045ed
commit 49cbf31872

View File

@ -34,7 +34,7 @@ class AsgiRequest(http.HttpRequest):
# Path info # Path info
# TODO: probably needs actual URL decoding # TODO: probably needs actual URL decoding
self.path = self.message['path'].decode("ascii") self.path = self.message['path'].decode("ascii")
self.script_name = self.message.get('root_path', '') self.script_name = self.message.get('root_path', b'')
if self.script_name: if self.script_name:
# TODO: Better is-prefix checking, slash handling? # TODO: Better is-prefix checking, slash handling?
self.path_info = self.path[len(self.script_name):] self.path_info = self.path[len(self.script_name):]
@ -44,7 +44,7 @@ class AsgiRequest(http.HttpRequest):
self.method = self.message['method'].upper() self.method = self.message['method'].upper()
self.META = { self.META = {
"REQUEST_METHOD": self.method, "REQUEST_METHOD": self.method,
"QUERY_STRING": self.message.get('query_string', '').decode("ascii"), "QUERY_STRING": self.message.get('query_string', b'').decode("ascii"),
# Old code will need these for a while # Old code will need these for a while
"wsgi.multithread": True, "wsgi.multithread": True,
"wsgi.multiprocess": True, "wsgi.multiprocess": True,