Ticket #2970: http_response_insensitive.2.patch
File http_response_insensitive.2.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 … … 188 189 def __getitem__(self, header): 189 190 return self.headers[header] 190 191 192 def get_headers(self): 193 return self._headers 194 195 def set_headers(self, headers): 196 self._headers = CaseInsensitiveDict(headers) 197 198 headers = property(get_headers, set_headers) 199 191 200 def has_header(self, header): 192 201 "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 202 return self.headers.has_key(header) 198 203 199 204 def set_cookie(self, key, value='', max_age=None, expires=None, path='/', domain=None, secure=None): 200 205 self.cookies[key] = value