Ticket #2970: http_response_insensitive.patch
File http_response_insensitive.patch, 1.2 KB (added by , 18 years ago) |
---|
-
django/http/__init__.py
3 3 from pprint import pformat 4 4 from urllib import urlencode, quote 5 5 from django.utils.datastructures import MultiValueDict 6 from django.utils.case_insensitive_dict import CaseInsensitiveDict 6 7 7 8 RESERVED_CHARS="!*'();:@&=+$,/?%#[]" 8 9 … … 166 167 else: 167 168 self._container = [content] 168 169 self._is_string = True 169 self.headers = {'Content-Type': mimetype}170 self.headers = CaseInsensitiveDict({'Content-Type': mimetype}) 170 171 self.cookies = SimpleCookie() 171 172 self.status_code = 200 172 173 … … 190 191 191 192 def has_header(self, header): 192 193 "Case-insensitive check for a header" 193 header = header.lower() 194 for key in self.headers.keys(): 195 if key.lower() == header: 196 return True 197 return False 194 return self.headers.has_key(header) 198 195 199 196 def set_cookie(self, key, value='', max_age=None, expires=None, path='/', domain=None, secure=None): 200 197 self.cookies[key] = value