The views are executed in an environment that includes anything defined in models as well as whatever items are passed in the dictionary from the controller function. Other objects defined in the controller are not available in the view environment. So, you must pass items directly from the controller functions. You could put all the parameters in a single dictionary or Storage object and pass that one object from each function, or you could consider putting the parameters in the response object. Another option might be to have your functions return response.render(globals()).
Anthony On Wednesday, April 15, 2015 at 7:35:00 AM UTC-4, Annet wrote: > > In a controller I got functions that use the same variables. > I want to assign a value to them outside any function: > > > if request.args(0) == 'openinghours': > rdrctUrl = URL('opening_hours') > function_header = 'Opening hours' > function_icon = 'fa-clock-o' > table = db.cal_opening_hours > elif request.args(0) == 'eventlist': > rdrctUrl = URL('event_list') > function_header = 'Event list' > function_icon = 'fa-calendar-o' > table = db.cal_event_list > > def insert(): > .... > return locals() > > def update(): > .... > return locals() > > def opening_hours(): > .... > return locals() > > etc. > > > The variables rdrctUrl en table are available in the functions, however, > function_header > and function_icon which I need in views are not available in the views. > Where do I store > them to make them available in the views. > > Kind regards, > > Annet > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.