You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defcoerce_put_post(request):
""" The try/except abominiation here is due to a bug in mod_python. This should fix it. """ifrequest.method=="PUT":
# Bug fix: if _load_post_and_files has already been called, for# example by middleware accessing request.POST, the below code to# pretend the request is a POST instead of a PUT will be too late# to make a difference. Also calling _load_post_and_files will result# in the following exception:# AttributeError: You cannot set the upload handlers after the upload has been processed.# The fix is to check for the presence of the _post field which is set# the first time _load_post_and_files is called (both by wsgi.py and# modpython.py). If it's set, the request has to be 'reset' to redo# the query value parsing in POST mode.ifhasattr(request, '_post'):
delrequest._postdelrequest._filestry:
request.method="POST"request._load_post_and_files()
request.method="PUT"exceptAttributeError:
request.META['REQUEST_METHOD'] ='POST'request._load_post_and_files()
request.META['REQUEST_METHOD'] ='PUT'request.PUT=request.POST
source https://thihara.github.io/Django-Req-Parsing/
The text was updated successfully, but these errors were encountered: