[web2py] Re: Issue running doctest with decorated functions

2013-10-03 Thread Mirko
Done here : https://code.google.com/p/web2py/issues/detail?id=1703 A possible workaround could be to add the following lines somewhere where it is always called (cmd_options.test is None for normal use): if request.global_settings.cmd_options.test: auth.login_bare('userlogin','userpassword')

[web2py] Re: Issue running doctest with decorated functions

2013-10-03 Thread Anthony
On Thursday, October 3, 2013 4:55:01 PM UTC-4, Massimo Di Pierro wrote: > please open a ticket about this. we need a new request.is_shell option or > something similar to detect this state. > request.global_settings.cmd_options can be used to distinguish other command line executions as well, s

[web2py] Re: Issue running doctest with decorated functions

2013-10-03 Thread Massimo Di Pierro
please open a ticket about this. we need a new request.is_shell option or something similar to detect this state. On Thursday, 3 October 2013 09:52:07 UTC-5, Mirko wrote: > > Eventually I got something working (may be crappy) to put on top of > controller file: > > *if request.global_settings.cm

[web2py] Re: Issue running doctest with decorated functions

2013-10-03 Thread Mirko
Eventually I got something working (may be crappy) to put on top of controller file: *if request.global_settings.cmd_options.test.startswith('%s/%s' % (request.application,request.controller)): auth.login_bare('user_for_test','his/her password') * Mirko On Thursday, October 3, 2013 3:58:31

[web2py] Re: Issue running doctest with decorated functions

2013-10-03 Thread Mirko
Hi Massimo, thank you very much for helping! However it looks like request.function contains '_TEST' only when doctest is run from the web IDE, and contains function name when run from command line.. On Thursday, October 3, 2013 3:25:24 PM UTC+2, Massimo Di Pierro wrote: > > You need to add some

[web2py] Re: Issue running doctest with decorated functions

2013-10-03 Thread Massimo Di Pierro
You need to add some logic that says: if request.function = '_TEST': auth.login_bare('user_for_test','his/her password') On Thursday, 3 October 2013 07:02:09 UTC-5, Mirko wrote: > > Hi all, > > I confirm "*python web2py.py -T a/b/c"* is not working with 2.5.1 when > function c is decorated

[web2py] Re: Issue running doctest with decorated functions

2013-10-03 Thread Mirko
Hi all, I confirm "*python web2py.py -T a/b/c"* is not working with 2.5.1 when function c is decorated with *@auth.requires_login()* It works fine without that decoration and I don't know how to authenticate when running doctests from command line, any suggestions ? Many thanks! Mirko On Fri