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')



On Thursday, October 3, 2013 10:55:01 PM UTC+2, 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.
>
> 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.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 PM UTC+2, Mirko wrote:
>>>
>>> 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 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 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 Friday, October 16, 2009 5:11:49 PM UTC+2, mdipierro wrote:
>>>>>>
>>>>>> I cannot say on top of my head. I would look into the 
>>>>>> build_environment when/where that is set. 
>>>>>> Thanks for looking into this. It is an important problem that needs 
>>>>>> to 
>>>>>> be solved. 
>>>>>>
>>>>>> Massimo 
>>>>>>
>>>>>> On Oct 16, 10:03 am, rboissat <[email protected]> wrote: 
>>>>>> > One issue though, with the code given above for instantiating a 
>>>>>> dummy 
>>>>>> > env, 
>>>>>> > I get this traceback:http://oxynux.org/pastebin/lbc6tu-534 
>>>>>> > 
>>>>>> > It seems that in the line: 
>>>>>> > 
>>>>>> > SQLDB._set_thread_folder(os.path.join(request.folder, 'databases')) 
>>>>>> > 
>>>>>> >  request.folder is NoneType, therefore making os.path.join fail. 
>>>>>> > 
>>>>>> > This is rather odd, cause in the tested controller, a: 
>>>>>> > 
>>>>>> > print request.folder 
>>>>>> > 
>>>>>> > gives me the the right path to my application. 
>>>>>> > 
>>>>>> > Any idea?
>>>>>
>>>>>

-- 
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/groups/opt_out.

Reply via email to