Fix encoding for robots.txt view response

This commit is contained in:
Lance Edgar 2018-02-14 10:31:04 -06:00
parent cfb6cf5ab4
commit cb2234cef5

View file

@ -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):
"""