PUT parameters not working in python / google app engine

Posted by magegu on Stack Overflow See other posts from Stack Overflow or by magegu
Published on 2010-12-26T19:11:29Z Indexed on 2010/12/26 22:54 UTC
Read the original article Hit count: 256

hi, i'm working on a simple RESTful webservice with python with the webapp framework on the google app engine.

Basically i'm sending all request via AJAX/jquery - for POST it works like a charm, but when I'm sending data with PUT, the parameters are empty / not processed.

this is my PUT:

    $.ajax({
        type: "PUT",
        url: "/boxes",
        data: { name: this.name, archived: this.archived  },
        success: function(msg){
        }
    });

firebug saids i'm putting:

Parameter   application/x-www-form-urlencoded
archived    false
name    123112323asdasd

but using this python code:

from google.appengine.ext import webapp
from google.appengine.ext.webapp import util, template
from google.appengine.ext import db
from google.appengine.api.datastore_types import *
from django.utils import simplejson as json

import cgi
import datetime

class BoxHandler(webapp.RequestHandler):

def post(self): #working
    print "test"
    self.response.out.write(self.request.get("name"))

def put(self):
    print "test" #not working
    self.response.out.write(self.request.get("name"))

will just return

test
Status: 200 OK
Content-Type: text/html; charset=utf-8
Cache-Control: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Content-Length: 0

so .. hm, is there anything i'm missing here?

cheers, Martin

© Stack Overflow or respective owner

Related posts about python

Related posts about http