django.http.parse_file_upload

Here are the examples of the python api django.http.parse_file_upload taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

Example 1

Project: talk.org Source File: modpython.py
Function: load_post_and_files
    def _load_post_and_files(self):
        "Populates self._post and self._files"
        if 'content-type' in self._req.headers_in and self._req.headers_in['content-type'].startswith('multipart'):
            self._post, self._files = http.parse_file_upload(self._req.headers_in, self.raw_post_data)
        else:
            self._post, self._files = http.QueryDict(self.raw_post_data, encoding=self._encoding), datastructures.MultiValueDict()

Example 2

Project: talk.org Source File: wsgi.py
Function: load_post_and_files
    def _load_post_and_files(self):
        # Populates self._post and self._files
        if self.method == 'POST':
            if self.environ.get('CONTENT_TYPE', '').startswith('multipart'):
                header_dict = dict([(k, v) for k, v in self.environ.items() if k.startswith('HTTP_')])
                header_dict['Content-Type'] = self.environ.get('CONTENT_TYPE', '')
                self._post, self._files = http.parse_file_upload(header_dict, self.raw_post_data)
            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()

Example 3

Project: theyworkforyou Source File: modpython.py
Function: load_post_and_files
    def _load_post_and_files(self):
        "Populates self._post and self._files"
        if self._req.headers_in.has_key('content-type') and self._req.headers_in['content-type'].startswith('multipart'):
            self._post, self._files = http.parse_file_upload(self._req.headers_in, self.raw_post_data)
        else:
            self._post, self._files = http.QueryDict(self.raw_post_data), datastructures.MultiValueDict()

Example 4

Project: theyworkforyou Source File: wsgi.py
Function: load_post_and_files
    def _load_post_and_files(self):
        # Populates self._post and self._files
        if self.method == 'POST':
            if self.environ.get('CONTENT_TYPE', '').startswith('multipart'):
                header_dict = dict([(k, v) for k, v in self.environ.items() if k.startswith('HTTP_')])
                header_dict['Content-Type'] = self.environ.get('CONTENT_TYPE', '')
                self._post, self._files = http.parse_file_upload(header_dict, self.raw_post_data)
            else:
                self._post, self._files = http.QueryDict(self.raw_post_data), datastructures.MultiValueDict()
        else:
            self._post, self._files = http.QueryDict(''), datastructures.MultiValueDict()