You can use validators in scripts with .validate_and_insert or .update_and_insert
http://zerp.ly/rochacbruno Em 25/04/2012 15:53, "nick name" <[email protected]> escreveu: > On Tuesday, April 24, 2012 9:24:34 AM UTC-4, Massimo Di Pierro wrote: >> >> I think this belongs to the validator. If the validator has already >> removed the subseconds you are in no luck. >> If it works for you, I do not see a problem. Anyway, remember that this >> API is experimental. They will stay but we may still change something >> before 2.0 >> > > The data is not coming from a web-form. It is coming from other sources > (legacy database, and others). So there is no validator involved, and the > subseconds are still intact. > > The different web2py database adapters all remove subseconds in their > conversions to string (which is how they all insert to the dbapi). I've > submitted patches before to make that user selectable, but you didn't like > them. > > It seems like the _before_insert is working for me - I get to convert to > string including subseconds before web2py gets a chance to do that, and > web2py uses what I converted. > > Note: One can always just insert string values instead, and they would get > to the database with subseconds intact. However, the problem is that if I > forget to convert to string, web2py will silently remove them. >

