[web2py] Re: calling secured function from cron

2010-07-28 Thread mdipierro
No because the function has no way to know it is being access by CRON. Moreover if the function requires login it probably assumes the existence of a user. In case of cron who is the user? What if no user yet registered with the app? On Jul 28, 10:24 am, Iceberg wrote: > I am digging out an old

[web2py] Re: calling secured function from cron

2010-07-28 Thread Iceberg
I am digging out an old thread, quoted at the of this post, (up side down). I can confirmed Mika's problem does exist. In fact, not to mention cron feature, even a normal request from browser will be intercepted by any presence of @auth.requires(...) For example: @auth.requires(True) # or aut

[web2py] Re: calling secured function from cron

2010-06-29 Thread mika
why should I put there? I have logging function defined in models/log.py. It works correctly, I think. You want request.client? so when I call by hand it gives "127.0.0.1", when it is from Cron it gives "None" but only if function is NOT secured. When it is secured it is not called properly and gi

[web2py] Re: calling secured function from cron

2010-06-29 Thread mdipierro
Please add a logging.info(str(request.client)) Outside the function, in a model. On 29 Giu, 04:41, mika wrote: > I have following line in crontab: > * * * * *               root *cpe_lang/test_only > > the function in controller is defined as: > > @auth.requires( (request.client==None) or >

[web2py] Re: calling secured function from cron

2010-06-29 Thread mika
I have following line in crontab: * * * * * root *cpe_lang/test_only the function in controller is defined as: @auth.requires( (request.client==None) or (auth.has_membership('managers')) ) def test_only(): logging.error('Test cron') logging.info(str(request)) if request.

[web2py] Re: calling secured function from cron

2010-06-28 Thread mdipierro
When you say does not work, what do you get? A traceback? Can you print these and see what they contain? request.env request.wsgi request.client Massimo On 28 Giu, 08:40, mika wrote: > I tried also > request.wsgi.environ==None > doesn't work also > > how to make cron call function with auth?

[web2py] Re: calling secured function from cron

2010-06-28 Thread mika
I tried also request.wsgi.environ==None doesn't work also how to make cron call function with auth? I can't believe that nobody did it or nobody needs it! Web2py should have such feature

[web2py] Re: calling secured function from cron

2010-06-24 Thread mika
@auth.requires(request.client==None or auth.has_membership('managers')) don't work. What do u mean about fake authentication? how to do it? On Jun 22, 3:31 am, Álvaro Justen wrote: > On Mon, Jun 21, 2010 at 13:30, mdipierro wrote: > > try > > > @auth.requires(request.client==None or > > auth.

Re: [web2py] Re: calling secured function from cron

2010-06-21 Thread Álvaro Justen
On Mon, Jun 21, 2010 at 13:30, mdipierro wrote: > try > > @auth.requires(request.client==None or > auth.has_membership('managers')) I think the best way to do it is to fake an authentication in the cron script, isn't it? -- Álvaro Justen - Turicas http://blog.justen.eng.br/ 21 9898-0141

[web2py] Re: calling secured function from cron

2010-06-21 Thread mdipierro
try @auth.requires(request.client==None or auth.has_membership('managers')) On Jun 21, 2:53 am, mika wrote: > hi > I can't find solution to call the function protected by auth from > cron. > > I have defined auth group managers, and decorated function with > > @auth.requires(not request.wsgi or