clear enough for callback function, thank you so much for detail 
explaination, anthony, better to move it to modules, it didnt appear in 
snakeviz result when it's not called
for current i understand the reason, but when i move it to lambda or 
function without arguments, it return an error.
*e.g.*
*modules/test_field_constructor.py*
#requires_date = lambda: IS_DATE(format = current.T('%Y-%m-%d'), 
error_message = current.T('Enter date as yyyy-mm-dd') )
def requires_date(): 
return IS_DATE(format = current.T('%Y-%m-%d'), error_message = 
current.T('Enter date as yyyy-mm-dd') )

*controllers/default.py*
def test_form():
redirect_url = 'test'
form = SQLFORM.factory(
Field("from_date", "date", 
 requires = test_field_constructor.requires_date) )
if form.process().accepted:
from_date = form.vars.from_date

response.new_window = URL(redirect_url, args = from_date)
elif form.errors:
response.flash = T('Form has errors')
return dict(form = form)

*error traceback :*
raise Exception(msg)
Exception: Validation error, field:from_date <function <lambda> at 
0x10e9d6c80>

any idea how to use lambda or function without arguments in web2py modules?

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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to