In Tornado, you can link Regexes to RequestHandlers. The matched groups from the Regexes get passed into the RequestHandler’s get() or post() method as arguments.
The problem is, I want to read the values of these matched groups before the get() or post() is called. Does Tornado have a way of accessing these matched groups outside of get() or post()? I want something analogous to RequestHandler.arguments.
Unfortunately, there does not seem to be a way to access the url regex match from “prepare”.
Looking at the code in
tornado/web.py, especially line 949,prepareis called without parameters at all.I’ve hacked together a solution, that works, but it’s not robust at all… Here it is.