what do you mean by number of callbacks ? If you need a check - of previous existence of the record - you can't skip the check itself (this is what the database does when you enforce a PK anyway) The only callback you need is before_insert, but that's not optional. For what is worth, you can as well use always update_or_insert() interacting with that table, but a check will be done even in that case.
On Thursday, February 28, 2013 5:43:18 PM UTC+1, Alec Taylor wrote: > > Are those executing all in one callback to the database? > > To me it seems like I can get the same # of callbacks by: > 1. Find record (x,y) in db > 2. If exists, return "Exists" msg > 3. Else, insert (x,y) into db > > So this naïve method would have two callbacks, and be quite inefficient. > > Can I do this with one callback? > > On Fri, Mar 1, 2013 at 2:59 AM, DenesL <[email protected] <javascript:>> > wrote: > > http://web2py.com/books/default/chapter/29/06#before-and-after-callbacks > > > > > > On Thursday, February 28, 2013 10:43:12 AM UTC-5, Alec Taylor wrote: > >> > >> Thanks, at the moment form validation is fine to do without. > >> > >> What are these new DAL callbacks you're speaking of? :) > > > > -- > > > > --- > > 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 [email protected] <javascript:>. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- --- 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

