0
在我的谷歌App Engine應用程序,我有一個方法的處理程序PUT請求:我的self.error()在Google App Engine中被覆蓋了嗎?
def postMethod(self, arg):
response = do_backend_work(arg)
if response.field is None:
self.error(502)
self.response.out.write(json.dumps(
{'message': "you've been a bad boy!"}))
else:
<deal with well-formatted requests here>
.
.
.
然而,當我收到一個請求,其中response.field
爲None
當我趕上了請求返回了200元。這個錯誤我插入raise Exception(str(self.response))
只是else
塊作爲一個全面的檢查前,發現這個在日誌中:
raise Exception(str(self.response))
Exception: 502 Bad Gateway
Content-Type: text/html; charset=utf-8
Cache-Control: no-cache
Content-Length: 63
{"message": "you've been a bad boy!"}
INFO 2012-08-15 23:25:12,239 dev_appserver.py:2952]
"PUT /url/resource HTTP/1.1" 200 -
是有什麼我缺少有關App Engine是如何處理請求?