Maybe one way of solving this is by using helper methods (instead of
actuall handlers) which would be called from your "route" handler and
the original handlers.
-alex
--
a lex 13 x
http://a13x.net | @a13xnet
It seems to me that you're doing something out of the ordinary.. First
of all, why are you implementing a "route" handler, when the routing
is very capable?
Maybe one way of solving this is by using helper methods (instead of
actuall handlers) which would be called from your "route" handler and
the original handlers.
-alex
--
On Wed, Mar 21, 2012 at 12:30 PM, Meir Kriheli <mkri...@gmail.com> wrote:
> Hi,
>
> I'd like to instantiate and call another handler from the current handler
> using the same method, using it to add to (or optionally replace) the
> current response. The original handlers should and can be called as usual
> (via url spec)
>
> This is needed for the implementation of "route" handler, which will serve
> the responses from the appropriate handlers based on GET params - so URL
> specs won't help.
>
> Is instantiating the handler (passing to it the application and request)
> enough ? How is the response handled in that case ?
>
> Thanks
> --
> Meir
a lex 13 x
http://a13x.net | @a13xnet
You can take a look at tornado.auth mixins for ideas.
- Didip -
Assuming your routing looks like this:Application([(r"/get/movies", MoviesHandler),(r"/get_section/([^/]+)", SectionHandler),])You can do this in MoviesHandler:class MoviesHandler(RequestHandler):def get(self):SectionHandler(self.application, self.request).get(movies_section_id)Your use case is interesting. I wrote a web framework on top of the Tornado HTTPServer that would handle exposing the same resource through multiple URIs quite gracefully - I should get around to releasing it.Alek