OK, my script is working fine, but the problem is this, I'm launching this
script:
import time
print "Initializing booking daemon @_@"
while True:
allBookings = db(db.current_bookings).select()
for booking in allBookings:
if booking.project != 'foo':
print str(booking)
prName = booking.project
platf = booking.platform
table = getattr(db, '%s'%prName)
toUpdate = db(table.id == platf).select()
for t in toUpdate:
t.update_record(platform_owner = 'Free')
print "Row Updated"
else:
print "Nothing Updated"
None
db.commit()
time.sleep(30)
like this:
python web2py.py -a 123 -i 127.0.0.1 -p80 -S init -M -N -R
applications/init/private/bot.py
And if I check my DB my script is doing its job, but if I launch it like
this I can't go to the website! (I guess that's because the -S init) but if
I erase it, the Script doesn't work.
On Mon, Jul 18, 2011 at 11:09 PM, Ismael Serratos <[email protected]>wrote:
> I tried putting it into a controller, also as a separated file into private
> folder
>
>
>
>
>
> On Mon, Jul 18, 2011 at 8:36 PM, pbreit <[email protected]> wrote:
>
>> Where is this code located and how are you calling it? If it's in a
>> controller, you may need to call bookings() with an argument.
>>
>> Did you review this:
>>
>> http://web2py.com/book/default/chapter/04?#Background-Processes-and-Task-Queues
>>
>
>