我是Python和Pylons的新手,想知道如何才能绕过pylons应用程序的启动例程。
我找到了中间件,并想要这样做:
if error:
abort(404)但是,如果Error为true,则会显示500内部Server错误消息,而不是404 Not Found消息。
有没有人能告诉我怎么才能中断塔架的运行?
发布于 2011-03-22 00:18:43
尝试在呼叫中添加消息:
abort(404,"404 Not Found");此外,您还可以自定义错误文档。请参阅:http://wiki.pylonshq.com/display/pylonsdocs/Error+Documents#changing-the-template
发布于 2015-11-20 14:37:52
问题出在条件not abort上。
尝试这样做:
def test(self):
username = ''
if not username:
abort(404)https://stackoverflow.com/questions/5380395
复制相似问题