class Application(tornado.web.Application):
def __init__(self):
handlers = [
(r"/", MainHandler),
(r"/auth/login", AuthLoginHandler),
(r"/auth/logout", AuthLogoutHandler),
(r"/auth/register",RegisterHandler),
(r'/user/([a-z\d.]{5,})/?',UserHandler),
(r'/user/([a-z\d.]{5,})/friends',UserFriendHandler),
(r'/user/([a-z\d.]{5,})/status',StatusHandler),
(r'/user/([a-z\d.]{5,})/wall',WallHandler),
(r'/actions/respond_friend',FriendActionHandler),
]
这是我的处理程序数组。这可能会增长得更多。我的问题涉及到这一行:
(r'/actions/respond_friend',FriendActionHandler),
我计划使用这条线通过帖子响应朋友请求,将朋友的用户名作为帖子参数。发送帖子时如何检索此参数(它“存储”在哪里)?这样做是否更有意义:
(r'/user/([a-z\d.]{5,})/actions/respond_friend',FriendActionHandler),