Ticket #5682: patch_django_5682_modpython.diff

File patch_django_5682_modpython.diff, 2.5 KB (added by listuser@…, 17 years ago)
  • django/core/handlers/modpython.py

     
    2828        except:
    2929            post = '<could not parse>'
    3030        try:
     31            put = pformat(self.PUT)
     32        except:
     33            put = '<could not parse>'
     34        try:
    3135            cookies = pformat(self.COOKIES)
    3236        except:
    3337            cookies = '<could not parse>'
     
    3539            meta = pformat(self.META)
    3640        except:
    3741            meta = '<could not parse>'
    38         return '<ModPythonRequest\npath:%s,\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s>' % \
    39             (self.path, get, post, cookies, meta)
     42        return '<ModPythonRequest\npath:%s,\nGET:%s,\nPOST:%s,\nPUT:%s,\nCOOKIES:%s,\nMETA:%s>' % \
     43            (self.path, get, post, put, cookies, meta)
    4044
    4145    def get_full_path(self):
    4246        return '%s%s' % (self.path, self._req.args and ('?' + self._req.args) or '')
     
    5155    def _load_post_and_files(self):
    5256        "Populates self._post and self._files"
    5357        if 'content-type' in self._req.headers_in and self._req.headers_in['content-type'].startswith('multipart'):
    54             self._post, self._files = http.parse_file_upload(self._req.headers_in, self.raw_post_data)
     58            self._put, self._post, self._files = http.parse_file_upload(self._req.headers_in, self.raw_post_data)
    5559        else:
    56             self._post, self._files = http.QueryDict(self.raw_post_data, encoding=self._encoding), datastructures.MultiValueDict()
     60            self._put, self._post, self._files = http.QueryDict(self.raw_post_data, encoding=self._encoding), datastructures.MultiValueDict()
    5761
    5862    def _get_request(self):
    5963        if not hasattr(self, '_request'):
     
    7680    def _set_post(self, post):
    7781        self._post = post
    7882
     83    def _get_put(self):
     84        if not hasattr(self, '_put'):
     85            self._load_post_and_files()
     86            self._put = self._post
     87        return self._put
     88
     89    def _set_put(self, put):
     90        self._put = put
     91
    7992    def _get_cookies(self):
    8093        if not hasattr(self, '_cookies'):
    8194            self._cookies = http.parse_cookie(self._req.headers_in.get('cookie', ''))
     
    128141
    129142    GET = property(_get_get, _set_get)
    130143    POST = property(_get_post, _set_post)
     144    PUT = property(_get_put, _set_put)
    131145    COOKIES = property(_get_cookies, _set_cookies)
    132146    FILES = property(_get_files)
    133147    META = property(_get_meta)
Back to Top