开发者

Error handling in the RequestHandler without embedding in URI

When a user sends a filled form, I want to print an error message in case there is an input error. One of the GAE sample codes does this by embedding the error message in the URI.

Inside the form handler (get):

self.redirect('/compos开发者_开发百科e?error_message=%s' % message)

and in the handler (get) of redirected URI, gets the message from request:

values = {
    'error_message': self.request.get('error_message'),
    ...

Is there a way to accomplish the same without embedding the message in the URI?


Is the values dict being rendered by the template engine? If so, you can pass the error string directly like this:

values = {
    'error_message': 'there is an error',
    ...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜