私はグーグルアプリエンジンのwebappフレームワークでPythonを使ったシンプルなRESTfulウェブサービスに取り組んでいます。
基本的に、私はすべてのリクエストをAJAX / jquery経由で送信しています-POSTの場合、それは魅力のように機能しますが、PUTを使用してデータを送信する場合、パラメーターは空であるか、処理されません。
これは私のPUTです:
$.ajax({
type: "PUT",
url: "/boxes",
data: { name: this.name, archived: this.archived },
success: function(msg){
}
});
ファイアバグは私が置いていると言った:
Parameter application/x-www-form-urlencoded
archived false
name 123112323asdasd
しかし、このPythonコードを使用します:
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"))
ただ戻る
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
だから..うーん、私がここで欠けているものはありますか?
乾杯、マーティン