On Mar 25, 2011, at 9:15 PM, james c. wrote:
> 
> Hi I'm new to web2py. I've made great progress in a few days with my
> project.
> 
> SUMMARY: for every view I call, I get default.py as the controller.
> Even if I specify app/view/view or app/namediffernt/view I still get
> default.py as the controller. I appreciate any ideas or pointers on
> what to try. thanks in advance, james
> 
> MORE DETAIL:
> 
> I've read the documentation and here and tried some different
> approaches. The app is something like this:
> 
> Anyone can access the hello page and sub pages(page1, page2,
> page3, ... page7) none of these pages require log in and present
> static content. A registered user can log-in and access and update
> contents of a database. In menu.py and (default.py, under def index()
> {   I check if the user is logged-in.  if so the I send them off to
> the protected page, by using
> logged in, if so they are sent off to their view via:
> response.view='protected_page.html'.

Short answer: you can't get to another controller (or function for that matter) 
by setting response.view; response.view is used to render the output of the 
current controller/function.

Look at redirect() for at least some of these cases.


> 
> I've also tried response.view='different_controller/protected_page' .
> First I was trying with the controller and the view html page having
> the same name. I read under some conditions that may not work so as
> shown in my example I'm using a controller with a different name from
> the view. I've tried also putting this in menu.py. and tried putting
> {{response.view=different_controller/...ect}} into the view.html
> I also tried using redirect and URL with no success. Every case I
> ended up either breaking the application or the no matter or with
> default.py. (regardless of what controller explicitly specified) If I
> just put all the logic in default.py I can probably getting it
> working. But I would like to understand what is going on and structure
> the application appropriately.
> 
> Sorry for the rambling, but am somewhat sleep deprived from working on
> this continuously the past three days. I appreciate any
> recommendations on what to look at or try. Thanks in advance. James


Reply via email to