I'm trying to make a token double submit mechanism for my cherrypy website.
The client side rpc always includes a "_token" parameter in开发者_开发问答 request. I would prefer not to add "_token" as a parameter to every request handling function i write. I just want to check cherrypy.request.params["_token"] in an "on_start_resource" Tool i've added.
Have your on_start_resource Tool delete "_token" from the cherrypy.request.params dict when it's done with it. cf http://docs.python.org/library/stdtypes.html#dict.pop
精彩评论