mirror of https://github.com/zulip/zulip.git
Support request.FILES in process_as_post.
(imported from commit 646019b5efe4ae3f6f66f99f76f2036d9fd9ec8e)
This commit is contained in:
parent
a02fe71788
commit
2b28cf9a0a
|
@ -141,8 +141,11 @@ def process_as_post(view_func):
|
||||||
if not request.POST:
|
if not request.POST:
|
||||||
# Only take action if POST is empty.
|
# Only take action if POST is empty.
|
||||||
if request.META.get('CONTENT_TYPE', '').startswith('multipart'):
|
if request.META.get('CONTENT_TYPE', '').startswith('multipart'):
|
||||||
request.POST = MultiPartParser(request.META, StringIO(request.body),
|
# Note that request._files is just the private attribute that backs the
|
||||||
[], request.encoding).parse()[0]
|
# FILES property, so we are essentially setting request.FILES here. (In
|
||||||
|
# Django 1.5 FILES was still a read-only property.)
|
||||||
|
request.POST, request._files = MultiPartParser(request.META, StringIO(request.body),
|
||||||
|
request.upload_handlers, request.encoding).parse()
|
||||||
else:
|
else:
|
||||||
request.POST = QueryDict(request.body, encoding=request.encoding)
|
request.POST = QueryDict(request.body, encoding=request.encoding)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue