Django

Code

Show
Ignore:
Timestamp:
07/01/08 10:10:51 (2 months ago)
Author:
jacob
Message:

Fixed #2070: refactored Django's file upload capabilities.

A description of the new features can be found in the new upload handling documentation; the executive summary is that Django will now happily handle uploads of large files without issues.

This changes the representation of uploaded files from dictionaries to bona fide objects; see BackwardsIncompatibleChanges for details.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/handlers/wsgi.py

    r6826 r7814  
    113113        if self.method == 'POST': 
    114114            if self.environ.get('CONTENT_TYPE', '').startswith('multipart'): 
    115                 header_dict = dict([(k, v) for k, v in self.environ.items() if k.startswith('HTTP_')]) 
    116                 header_dict['Content-Type'] = self.environ.get('CONTENT_TYPE', '') 
    117                 self._post, self._files = http.parse_file_upload(header_dict, self.raw_post_data) 
     115                self._raw_post_data = '' 
     116                self._post, self._files = self.parse_file_upload(self.META, self.environ['wsgi.input']) 
    118117            else: 
    119118                self._post, self._files = http.QueryDict(self.raw_post_data, encoding=self._encoding), datastructures.MultiValueDict()