Пример #1
0
 def _load_post_and_files(self):
     # Populates self._post and self._files
     if self.method == 'POST':
         if self.environ.get('CONTENT_TYPE', '').startswith('multipart'):
             self._raw_post_data = ''
             try:
                 self._post, self._files = self.parse_file_upload(
                     self.META, self.environ['wsgi.input'])
             except:
                 # An error occured while parsing POST data.  Since when
                 # formatting the error the request handler might access
                 # self.POST, set self._post and self._file to prevent
                 # attempts to parse POST data again.
                 self._post = http.QueryDict('')
                 self._files = datastructures.MultiValueDict()
                 # Mark that an error occured.  This allows self.__repr__ to
                 # be explicit about it instead of simply representing an
                 # empty POST
                 self._post_parse_error = True
                 raise
         else:
             self._post, self._files = http.QueryDict(
                 self.raw_post_data,
                 encoding=self._encoding), datastructures.MultiValueDict()
     else:
         self._post, self._files = http.QueryDict(
             '', encoding=self._encoding), datastructures.MultiValueDict()
Пример #2
0
    def _load_post_and_files(self):
        "Populates self._post and self._files"
        if self.method != 'POST':
            self._post, self._files = http.QueryDict(
                '', encoding=self._encoding), datastructures.MultiValueDict()
            return

        if 'content-type' in self._req.headers_in and self._req.headers_in[
                'content-type'].startswith('multipart'):
            self._raw_post_data = ''
            try:
                self._post, self._files = self.parse_file_upload(
                    self.META, self._req)
            except:
                # See django.core.handlers.wsgi.WSGIHandler for an explanation
                # of what's going on here.
                self._post = http.QueryDict('')
                self._files = datastructures.MultiValueDict()
                self._post_parse_error = True
                raise
        else:
            self._post, self._files = http.QueryDict(
                self.raw_post_data,
                encoding=self._encoding), datastructures.MultiValueDict()
Пример #3
0
 def _get_get(self):
     if not hasattr(self, '_get'):
         # The WSGI spec says 'QUERY_STRING' may be absent.
         self._get = http.QueryDict(self.environ.get('QUERY_STRING', ''),
                                    encoding=self._encoding)
     return self._get
Пример #4
0
 def _get_get(self):
     if not hasattr(self, '_get'):
         self._get = http.QueryDict(self._req.args, encoding=self._encoding)
     return self._get