From cb2234cef56bb2de557ebdaad0dce8bed6501e0b Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 14 Feb 2018 10:31:04 -0600 Subject: [PATCH] Fix encoding for robots.txt view response --- tailbone/views/common.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tailbone/views/common.py b/tailbone/views/common.py index e5710f2b..f48bdbe4 100644 --- a/tailbone/views/common.py +++ b/tailbone/views/common.py @@ -84,7 +84,14 @@ class CommonView(View): """ with open(self.robots_txt_path, 'rt') as f: content = f.read() - return Response(content_type=six.binary_type('text/plain'), body=content) + response = self.request.response + if six.PY3: + response.text = content + response.content_type = 'text/plain' + else: + response.body = content + response.content_type = b'text/plain' + return response def mobile_home(self): """