Thanks, Massimo. But, when the record is inserted, the field with "update" param shouldn't be None?
-- Vinicius Assef. On Mon, Nov 8, 2010 at 4:58 PM, mdipierro <[email protected]> wrote: > This is misunderstanding. Yes what you have is correct. > > The default=datetime.now() and update=datetime.now() is evaluated only > ONCE when the table is defined therefore when you insert and update > the values are always the same. > > BUT > > when the code is in a web2py controller, the model is run again at > every http request and therefore the values of default and request > will be updated. > > Massimo > > > > On Nov 8, 12:51 pm, Vinicius Assef <[email protected]> wrote: >> Buddies, this is what is happening, step by step: >> >> http://pastebin.com/b14HLy39 >> >> This test was made with latest stable version: Version 1.88.2 >> (2010-10-29 23:04:43) >> >> Again, am I missing something? >> >> I don't think there is a bug here. I expect I am making a really big >> and stupid mistake. >> This is too important to not be working out. >> >> By the way: I'm using Ubuntu 9.04. >> >> -- >> Vinicius Assef. >> >> On Mon, Nov 8, 2010 at 3:13 PM, Vinicius Assef <[email protected]> wrote: >> > Massimo, I expect the correct way is: >> >> > a) When inserting (sql insert) a new record: >> > 1) was_inserted_on receives request.now contents (this is ok) >> > 2) was_updated_on receives null >> >> > b) When updating (sql update) a record: >> > 1) was_inserted_on doesn't change is value (this is ok) >> > 2) was_update_on receives request.now >> >> > What is happening here, with web2py 1.87.3 and SQLite: >> >> > a) When inserting (sql insert) a new record: >> > 1) was_inserted_on receives request.now content >> > 2) was_updated_on receives request.now content >> >> > b) When updating (sql update) a record: >> > 1) was_inserted_on doesn't change its value >> > 2) was_update_on doesn't change its value >> >> > Am I loosing something? >> >> > -- >> > Vinicius Assef. >> >> > On Mon, Nov 8, 2010 at 2:27 PM, mdipierro <[email protected]> wrote: >> >> What you expect is correct and I cannot reproduce the problem. how do >> >> you update the record? >> >> >> On Nov 8, 8:54 am, Vinicius Assef <[email protected]> wrote: >> >>> I have this model just for test:http://pastebin.com/vF4VBLLM >> >> >>> Field 'was_inserted_on' is working all right. It has default insert >> >>> value and it isn't updated across record updates. It's ok. >> >> >>> But 'was_updated_on' is working the same way. >> >> >>> I imagined it was null when record is inserted and in every record >> >>> update, it would be this column updated. >> >> >>> At least, it was what I got from we2bpy manual in Record >> >>> Representation section (DAL chapter). >> >> >>> Where did I misunderstood? >> >> >>> By the way, I solved that using compute in was_updated_on field and >> >>> returning request.now. >> >> >>> -- >> >>> Vinicius Assef. >> >>

