Fix encoding for robots.txt view response
This commit is contained in:
		
							parent
							
								
									cfb6cf5ab4
								
							
						
					
					
						commit
						cb2234cef5
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		| 
						 | 
					@ -84,7 +84,14 @@ class CommonView(View):
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        with open(self.robots_txt_path, 'rt') as f:
 | 
					        with open(self.robots_txt_path, 'rt') as f:
 | 
				
			||||||
            content = f.read()
 | 
					            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):
 | 
					    def mobile_home(self):
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue