def from_multipart_form_data(self, request, **opts): from django.utils.datastructures import MultiValueDict # XXX not thrilled with this, but django itself uses an 'expect:' clause # to handle errors in this... so this is only slightly better... try: if hasattr(request, '_body'): data = StringIO(request._body) else: data = request post, files = request.parse_file_upload(request.META, data) data = MultiValueDict() data.update(post) data.update(files) return { key: value for key, value in data.iteritems() } except Exception, e: raise ValueError(str(e))