Hi ,
I've been wondering about the use of return locals() in the Forms chapter of the book, particularly with grids
def manage_users():
grid = SQLFORM.grid(db.auth_user)
return locals()
Elsewhere in the book use see something like this for forms
return dict
(form
=form
)
Would return dict(grid=grid) have given the same result as above? I know a dict is required to automatically use a view with the a/c/f.html naming standard, but what does locals() use ?
I think it would help to clarify this in the book?
Core chapter has:
Return a dictionary for a view:
def index(): return dict(key='value')
Return all local variables:
def index(): return locals()
and also this:
When an action returns a dictionary, web2py looks for a view with the name
1. |
[controller]/[function].[extension] |
and executes it.
Thanks
Andrew