I'm not quite clear on your preferred solution. The only thing your sidebar originally got from the controller was the result of a simple query. If you'd really like the entire sidebar to be generated like a full web2py page request, you can make it either an Ajax or non-Ajax component (via the LOAD helper). If you just want to be able to call a function, you can define the function in a model or module. But it's just a simple one-line query, so you might just as well keep it all in the sidebar view.
Anthony On Monday, December 24, 2012 10:38:01 AM UTC-5, jonas wrote: > > ok, to include everything in the for loop is more elegant. The reason > why I wanted to separate the call to sidebar.py is that the sidebar > contains almost static material that doesn't change that much, while > the main page (index page) has content that changes more. In the first > version I had the db variable defined in the index.py controller. I > Think this is a common situation, sidebar content that doesn't change > much and a main part that is updated more frequently so some sort of > content separation is preferable. > The solution to put it in the view instead is ok for me. > --

