You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the @add_route decorator works fine for doing procedural handlers, but if I want a class based handler that uses URI based routing instead of method based routing it doesn't work so hot.
I can catch all the calls in the get method, pick apart the route and figure out how to route them appropriately to different methods to handle different subroutes, but I'd rather be able to just do URI based invocations (similar to the way cherrypy works).
Is the functionality already in there and I'm not catching it? The add_route decorator isn't part of the WebMessageHandler class, so I haven't been able to do it that way and instead I've created an introspective get method that looks for an appropriate method to call based upon the name of the incoming route and the method (if it has a GET request to /foo/bar it looks for a "GET_foo_bar" method) but I am not going to keep going this way.
If there's already functionality for this can someone point it out to me and if not, I'll simply add in the add_route decorator functionality to the WebMessageHandler itself so you can do something like this:
class FooHandler(WebMessageHandler):
@add_route('/foo/bar', method='GET')
def blah(self):
self.set_body("You did a GET request to /foo/bar")
return self.render
so it operates similarly to the procedural decorator version.
The text was updated successfully, but these errors were encountered:
the @add_route decorator works fine for doing procedural handlers, but if I want a class based handler that uses URI based routing instead of method based routing it doesn't work so hot.
I can catch all the calls in the get method, pick apart the route and figure out how to route them appropriately to different methods to handle different subroutes, but I'd rather be able to just do URI based invocations (similar to the way cherrypy works).
Is the functionality already in there and I'm not catching it? The add_route decorator isn't part of the WebMessageHandler class, so I haven't been able to do it that way and instead I've created an introspective get method that looks for an appropriate method to call based upon the name of the incoming route and the method (if it has a GET request to /foo/bar it looks for a "GET_foo_bar" method) but I am not going to keep going this way.
If there's already functionality for this can someone point it out to me and if not, I'll simply add in the add_route decorator functionality to the WebMessageHandler itself so you can do something like this:
so it operates similarly to the procedural decorator version.
The text was updated successfully, but these errors were encountered: