1. Jesper Noehr
  2. django-piston
  3. Issues
Issue #36 resolved

utils.coerce_put_post resets request.FILES

Horst Gutmann
created an issue

The current implementation of utils.coerce_put_post seems to basically reset all the processing that has already been done on the request. An unexpected side-effect of this also seems to be, that request.FILES is regenerated from a now already empty datastream and therefor ends up empty on PUT requests.

Following implementation should work better in this regard since it simply copies the POST-content without actually causing any additional call of request._load_post_and_files() when request.FILES is accessed.



def coerce_put_post(request): if request.method == 'PUT': request.method = 'POST' request.PUT = request.POST request.method = 'PUT' }}}

Comments (5)

  1. Jesper Noehr repo owner
    • changed status to open

    The reason why we must do this is: If request.method is PUT, Django won't look at the data.

    At least this used to be the case. Can you experiment with it, and preferably write a testcase? Thanks.

  2. Log in to comment