response.view='default/bar1.html'

On May 18, 12:56 pm, Igor Gassko <[email protected]> wrote:
> Hi all.
>
> I'd like to have multiple views (several different html files) for the
> same controller action and to be able to specify in the code from
> within controller which view will be used to format the response.
>
> To be specific, let's say I have controller 'default.py' with action
> 'foo' in it and I have multiple views:
> default/bar1.html
> default/bar2.html
> default/bar3.html
>
> let's say I'm getting request as 
> follows:http://localhost:8000/myapp/default/foo?page=bar2
> I implement some logic in 'foo' and I want the response to be
> formatted by 'bar2.html' according to the request parameter 'page'.
> Is there some way to achieve this in web2py, except for messing with
> routes.py, which is something I'm extremely reluctant to do.
>
> Another way I can think of is to delegate the request handling from
> one controller action to another. In such case, I'd have controller
> 'foo' and controllers 'bar1', 'bar2' and 'bar3', and 'foo' will invoke
> 'bar2' according to the 'page' parameter. But I don't have a clue
> whether this is possible either.
>
> Any help will be appreciated!

Reply via email to