Ticket #5682: patch_django_5682_http.diff
File patch_django_5682_http.diff, 2.2 KB (added by , 17 years ago) |
---|
-
django_src/django/http/__init__.py
20 20 class HttpRequest(object): 21 21 "A basic HTTP request" 22 22 23 # The encoding used in GET/POST dicts. None means use default setting.23 # The encoding used in GET/POST/PUT dicts. None means use default setting. 24 24 _encoding = None 25 25 26 26 def __init__(self): 27 self.GET, self.POST, self. COOKIES, self.META, self.FILES ={}, {}, {}, {}, {}27 self.GET, self.POST, self.PUT, self.COOKIES, self.META, self.FILES = {}, {}, {}, {}, {}, {} 28 28 self.path = '' 29 29 self.method = None 30 30 31 31 def __repr__(self): 32 return '<HttpRequest\nGET:%s,\nPOST:%s,\n COOKIES:%s,\nMETA:%s>' % \33 (pformat(self.GET), pformat(self.POST), pformat(self. COOKIES),34 pformat(self. META))32 return '<HttpRequest\nGET:%s,\nPOST:%s,\nPUT:%s,\nCOOKIES:%s,\nMETA:%s>' % \ 33 (pformat(self.GET), pformat(self.POST), pformat(self.PUT), 34 pformat(self.COOKIES), pformat(self.META)) 35 35 36 36 def __getitem__(self, key): 37 for d in (self.POST, self.GET ):37 for d in (self.POST, self.GET, self.PUT): 38 38 if key in d: 39 39 return d[key] 40 raise KeyError, "%s not found in either POST or GET" % key40 raise KeyError, "%s not found in either POST, GET or PUT" % key 41 41 42 42 def has_key(self, key): 43 return key in self.GET or key in self.POST 43 return key in self.GET or key in self.POST or key in self.PUT 44 44 45 45 __contains__ = has_key 46 46 … … 81 81 82 82 def _set_encoding(self, val): 83 83 """ 84 Sets the encoding used for GET/POST accesses. If the GET or POST84 Sets the encoding used for GET/POST/PUT accesses. If the GET, POST or PUT 85 85 dictionary has already been created, it is removed and recreated on the 86 86 next access (so that it is decoded correctly). 87 87 """ … … 90 90 del self._get 91 91 if hasattr(self, '_post'): 92 92 del self._post 93 if hasattr(self, '_put'): 94 del self._put 93 95 94 96 def _get_encoding(self): 95 97 return self._encoding