i'm new to Python and Pylons and want to know how it is possible to cancle the start routin of the pylons app.
I found the middleware and want to do something like this:
if error:
abort(404)
But this brings me a 500 internal Server Er开发者_开发问答ror Message if error is true instead of a 404 Not Found Message.
Could anyone tell me how i can interupt start routin of pylons?
Try adding a message in the call:
abort(404,"404 Not Found");
As well, you can customize the error documents. See: http://wiki.pylonshq.com/display/pylonsdocs/Error+Documents#changing-the-template
The problem is with the condition not abort.
Try this way:
def test(self):
username = ''
if not username:
abort(404)
精彩评论