request.now works, but the point here is that datetime.now() gets called
the first time only. default can be a callable, so using datetime.now
(without parenthesis) works as expected
On Saturday, October 6, 2012 2:47:25 AM UTC+2, Adi wrote:
>
> would default=request.now work in this case?
>
> On Friday, October 5, 2012 8:27:52 PM UTC-4, Saurabh Kumar wrote:
>>
>> I have a table with follwing schema:
>>
>> db.define_table('active_connections',
>> db.Field('user','string'),
>> db.Field('last_seen','datetime',default=datetime.now()),
>> )
>>
>> I am inserting entries to this table from a web2py external python script
>> run with the following command:
>> python web2py.py -S chat -M -R applications/chat/private/script.py
>>
>> But instead of inserting current time in table entries, it inserts the
>> same time in all entries, the time when this script was run.
>> Why does this happen?
>>
>>
>>
--