This how i understand the relationship: I create a controller:
def index(): return dict(mylist = [1,2,3])
then i ihave to create a view with the same name i.e app/views/controller/index.html in which i refer to the server variable list
What about if i want to use the same controller index for an other view say myapp/anotherindex.html Can this be done or i have to create an other controller another_index and copy exactly the same code from the controller index()
My question is can the data computed in one controller used by many views?
def index(): return dict(mylist=[1,2,3]) def other(): return index()
index will be rendered by app/views/controller/index.html and other by app/views/controller/other.html. You can also have them share a view:
def yet_other(): response.view=request.controller+'/index.html' return index()
and yet another will use index as controller and index.html as view.