you're making things much more complicated than they really are.
the scheduler can't know about the user, but the controller that queues the 
task does.

so, I'd work on a function to schedule like:

def do_this(user_id):
    do_whatever_with_user_id

and queue it with 

mysched.queue_task(do_this, [auth.user_id])

Il giorno mercoledì 25 settembre 2013 16:53:19 UTC+2, Richard ha scritto:
>
> Read this thread :
>
> https://groups.google.com/d/msg/web2py/5w4YbZYNcWM/2Wi7V3jAsBIJ
>
> You will see, what you try to do is not that easy.
>
> Richard
>
>
> On Wed, Sep 25, 2013 at 10:39 AM, ajith c t <[email protected]<javascript:>
> > wrote:
>
>> is there any update or modification in comet_messenger, because I cannot 
>> see a file comet_messenger in the contrib folder. And I am not sure whether 
>> it is the solution, It seems like a websocket thing.
>>
>> What I need is how to find the current logged in user in scheduler task.
>>
>> I tried passing the user id from the controller in the queue_task call as 
>> parameter but it fails when I login with different user as queue_task is 
>> only called once when the app starts.
>>
>>
>> On Wednesday, 25 September 2013 19:05:00 UTC+5:30, Richard wrote:
>>
>>> I don't think you can be sure you have logged user except by using 
>>> comet_messenger.py contrib and tornado. There is many thread about this. 
>>>
>>> Richard
>>>
>>>
>>> On Wed, Sep 25, 2013 at 9:04 AM, ajith c t <[email protected]> wrote:
>>>
>>>>  Hi,
>>>>
>>>>     I have a scheduler which is setup in a model file. A set of task is 
>>>> written in the scheduler.py which is queued from the controller. My 
>>>> problem 
>>>> is I need to get the current logged in user in this scheduler.py file so 
>>>> that I can write query with respect to the logged in user.
>>>>
>>>> I can obtain the current logged in user using the command auth.user in 
>>>> the scheduler.py file. But when I call auth.user from a task defined in 
>>>> the 
>>>> same scheduler.py , file it returns none.
>>>>
>>>> scheduler.py file
>>>>
>>>> print auth.user
>>>>
>>>> def task1():
>>>>       logger.debug("current user: %s, auth.user)
>>>>       return 
>>>>
>>>>
>>>> the output in the first case is row of the  logged in user  while none 
>>>> in second case.
>>>>
>>>>  -- 
>>>> Resources:
>>>> - http://web2py.com
>>>> - http://web2py.com/book (Documentation)
>>>> - http://github.com/web2py/**web2py 
>>>> <http://github.com/web2py/web2py>(Source code)
>>>> - 
>>>> https://code.google.com/p/**web2py/issues/list<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 web2py+un...@**googlegroups.com.
>>>>
>>>> For more options, visit 
>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>> .
>>>>
>>>
>>>  -- 
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

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