Okay, so I have a strange issue. I have a simple database update in a 
function in a file called "scheduler.py" in the "models" folder. When I 
call this function from my website running on Apache, works great, no 
problem. 

However, when a scheduled task runs it (i.e. something like 
"/usr/bin/python /opt/web-apps/web2py/web2py.py -K myapp &" in rc.local on 
centos), the database doesn't get updated. Moreover, if that database 
update runs in a loop, it's only the LAST update that doesn't get committed 
to the database, as if there was an implicit commit before every update 
statement.

My fix is to simply call "db.commit()" after my update, but I don't 
understand why I need to do that. Again, it works great when, for example, 
someone clicks on a link on a webpage, but the same function doesn't give 
the same results when called from the scheduler. The documentation states, 
"In models, views and controllers there is no need to ever call commit or 
rollback explicitly." So I'm puzzled.

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to