From a3944eff5eb251c78fc1efe830c888f3d28d4f9d Mon Sep 17 00:00:00 2001 From: Maik Hoepfel Date: Thu, 9 Feb 2017 15:28:58 +0100 Subject: [PATCH] Fix accidental cast to byte string under Python 2 While grepping for calls to str(), I found this bit which looks like a cast to unicode was intended under Python 2. --- daphne/http_protocol.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daphne/http_protocol.py b/daphne/http_protocol.py index 2bc1903..b049899 100755 --- a/daphne/http_protocol.py +++ b/daphne/http_protocol.py @@ -269,7 +269,7 @@ class WebRequest(http.Request): (b"Content-Type", b"text/html; charset=utf-8"), ], "content": (self.error_template % { - "title": str(status) + " " + status_text.decode("ascii"), + "title": six.text_type(status) + " " + status_text.decode("ascii"), "body": body, }).encode("utf8"), })