In one action, I generate the following link for the user to edit an item:
A('edit',
_href=URL('edit_joke',
vars=dict(id=joke.joke.id,
backto=self.request.controller + '/' + self.request.function,
page=self.page,
moderate=self.request.get_vars.moderate)
),
_class='button')
The edit_joke action is in the controller full.py. edit_joke includes:
response.view = 'default/joke_basic.html'
return dict(form = form, topline = 'Edit this joke')
Clicking on the button will traverse to this url:
http://127.0.0.1:8000/pyjokes/full/edit_joke?backto=full%2Fmanage_jokes&id=12&moderate=None&page=0
(Note that even though I didn't include the controller in the URL helper
func, web2py knows the current controller. That is good. I doubt that I
need to refer to the controller in my backto arg either...)
However, when I click on the button, web2py tries to reference the wrong
view and generates an invalid path:
invalid view (full/edit_joke.html)
Why is response.view being ignored? The "default" in the path to the view
refers to the path for html templates: views/default/joke_basic.html. It
works for other actions that use the same view. It is only when I follow
the anchor link in code in a module. But, I have a delete button in the
same page that also refers to an action in the same controller--it works.
Also, pages in my response.menu that also use this template all work. All
the actions include an explicit response.view = ...
Why doesn't it work in this case?
--