On Wed, Jun 15, 2011 at 1:31 AM, Anthony <abasta...@gmail.com> wrote:
> On Tuesday, June 14, 2011 7:11:41 PM UTC-4, pbreit wrote: >> >> But vars=something() is not going to work, is it? In general you cannot >> call a function if it does not take parameters (web2py restricts those for >> serving requests only. > > > I think that's backwards. You cannot access a function *via a URL* if it * > does* take parameters (or if it starts with a double underscore), but > nothing is stopping you from calling a function that does not take > parameters. The something() function returns a dictionary, which is what the > 'vars' argument to response.render is expecting. I think it should work. > yes, it works: return response.render("%s/%s.%s" % (request.controller, "something", request.extension),something()) > > >> >> Of course the easiest and most correct way to do it is to redirect. >> > > Redirect is only a little less code, and it ends up generating a new > request. It also results in the URL changing, which may not be desirable. > > Anthony > redirect would create problems with ajax functions: see http://code.google.com/p/web2py/issues/detail?id=304 -- Sebastian E. Ovide