from gluon import current then you can use current.request, current.response, current.session, current.cache and current.T. The only catch is that you can use them in functions called by your app but not at top level. For example you cannot do:
request = current.request at top level in the module. On Wednesday, 25 September 2013 00:20:29 UTC-5, 黄祥 wrote: > > what is the best way, to using request, response, session, cache, t and > auth in modules? > i follow the anthony suggestion on this forum, it can be passed as an > argument when i call it from my controller. > my question is just auth that can be passed as an argument or everything > (request, response, session, cache, t and auth) ? > > e.g. > */test/modules/justforlearn.py* > def grid_0(table, has_membership_manager): > has_membership = current.auth.has_membership('Manager') > #has_membership = auth.has_membership('Manager') > grid=SQLFORM.grid(table, showbuttontext=False, > #editable=has_membership_manager, deletable=has_membership_manager > editable=has_membership, deletable=has_membership) > return locals() > > ref: > https://groups.google.com/forum/#!topic/web2py/urrcysiijgQ > > thanks and best regards, > stifan > -- 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/groups/opt_out.