Thank you very much - db.commit() is the solution!

2012/10/22 Niphlod <[email protected]>

> all code in the scheduler runs as you were running the function in the
> shell (as web2py.py -M -S yourapp)
>
> There's no "automatic" support for committing changes when the task is
> completed like there is the one when the request completes on web2py.
>
> You should call db.commit() in your functions wherever you need to save
> data to the db (or just call it at the end of the function)
>
>
>
> On Monday, October 22, 2012 10:12:05 PM UTC+2, mweissen wrote:
>>
>> Let's say I have a table
>>
>> db.define_table('sendprot',
>>   Field('myfield','integer', default=0))
>>
>> and a function like
>>
>> def testupdate():
>>     db.sendprot[1]=dict(myfield=2)
>>
>> Now I make this function a scheduler function and I set the
>> scheduler_task.status to QUEUED
>> The status becomes COMPLETED. Looks fine, but myfield did not change.
>>
>> A scheduler function can read a database table, but does it an insert or
>> an update?
>>
>> web2py last version, runs on a Linux computer.
>>
>> Regards, Martin
>>
>>
>>

-- 



Reply via email to