Python 我的self.error()是否在Google应用程序引擎中被覆盖?
在我的Google App Engine应用程序中,我有一个带有PUT请求方法的处理程序:Python 我的self.error()是否在Google应用程序引擎中被覆盖?,python,google-app-engine,http,Python,Google App Engine,Http,在我的Google App Engine应用程序中,我有一个带有PUT请求方法的处理程序: 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
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>
.
.
.
appengine是如何处理请求的,我有什么遗漏吗?经过仔细研究,我发现了问题所在。在我的
do_backend_work
函数中,有一个恶意打印语句劫持了输出流!这个故事的寓意是:不要在你的谷歌应用程序引擎后端给stdout写信。为了子孙后代的利益,我发布了这个问题
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 -