Ticket #2970: 2970.diff
File 2970.diff, 1.4 KB (added by , 17 years ago) |
---|
-
django/http/__init__.py
246 246 else: 247 247 self._container = [content] 248 248 self._is_string = True 249 self.headers = {' Content-Type': content_type}249 self.headers = {'content-type': content_type} 250 250 self.cookies = SimpleCookie() 251 251 if status: 252 252 self.status_code = status … … 258 258 + '\n\n' + self.content 259 259 260 260 def __setitem__(self, header, value): 261 self.headers[header ] = value261 self.headers[header.lower()] = value 262 262 263 263 def __delitem__(self, header): 264 264 try: 265 del self.headers[header ]265 del self.headers[header.lower()] 266 266 except KeyError: 267 267 pass 268 268 269 269 def __getitem__(self, header): 270 return self.headers[header ]270 return self.headers[header.lower()] 271 271 272 272 def has_header(self, header): 273 273 "Case-insensitive check for a header" 274 header = header.lower() 275 for key in self.headers.keys(): 276 if key.lower() == header: 277 return True 278 return False 274 return self.headers.has_key(header.lower()) 279 275 280 276 def set_cookie(self, key, value='', max_age=None, expires=None, path='/', domain=None, secure=None): 281 277 self.cookies[key] = value