[web2py] Re: put function on models or modules

2017-03-28 Thread 黄祥
got it, thank you so much for explaination, anthony 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

[web2py] Re: put function on models or modules

2017-03-28 Thread Anthony
> > Field("from_date", "date", > requires = test_field_constructor.requires_date) ) > Note, you have not created the requires_date function so that it acts as a validator -- rather, when called, it merely returns an instance of a validator. So, you must actually call it above:

[web2py] Re: put function on models or modules

2017-03-28 Thread 黄祥
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.

[web2py] Re: put function on models or modules

2017-03-27 Thread Anthony
On Monday, March 27, 2017 at 12:39:43 AM UTC-4, 黄祥 wrote: > > a, i c, my assumption is whatever showed in snakeviz result, is all the > python files that executed, btw, there still odd for me, why login_onfail > callback function is not showed snakeviz, wheter it's executed or defined? > Just

[web2py] Re: put function on models or modules

2017-03-26 Thread 黄祥
a, i c, my assumption is whatever showed in snakeviz result, is all the python files that executed, btw, there still odd for me, why login_onfail callback function is not showed snakeviz, wheter it's executed or defined? *an error traceback for IS_IN_DB() is :* requires_person =

[web2py] Re: put function on models or modules

2017-03-26 Thread Anthony
> > *db_schema_1_person.py:3()* > Line 3 is the line where the before_insert_person function is *defined, *not where it is *called*. The output does not indicate the function has actually been called. > *another question is about validator* > e.g. > requires_person = IS_IN_DB(db,

[web2py] Re: put function on models or modules

2017-03-26 Thread 黄祥
ok, i tried to minimalized the scope (start from simple scratch) *1. copy welcome scaffolding app* cp -R ~/site/web2py/applications/welcome/ ~/site/web2py/applications/z *2. Run Web2py with profiler* source ~/site/bin/activate python ~/site/web2py/web2py.py --nogui --no-banner -a 'a' -i 0.0.0.0 -p

[web2py] Re: put function on models or modules

2017-03-26 Thread Anthony
On Saturday, March 25, 2017 at 6:05:14 PM UTC-4, 黄祥 wrote: > > i mean that callback function is called when i hit the default/user login > screen > btw, your explaination about login_onfail is clear enough, but when > compare to the 2nd example, i've bit confused : > assuming the login_onfail is

[web2py] Re: put function on models or modules

2017-03-25 Thread 黄祥
i mean that callback function is called when i hit the default/user login screen btw, your explaination about login_onfail is clear enough, but when compare to the 2nd example, i've bit confused : assuming the login_onfail is the callback function and not executed when it's hit login screen

[web2py] Re: put function on models or modules

2017-03-25 Thread Anthony
What do you mean by the word "loaded"? Are you expected these functions to be executed? They are callback functions that are only executed in particular cases. For example, login_onfail will only be executed upon a failed login attempt. A table's on_define will be executed when it is fully