I have proposed a signal/slot system for the new DAL. Simply, The DAL provides an interface to "register" functions for common operations, such as select/insert/update/delete.
You will simply db.register('pre_delete', myFunc) db.register('post_delete', myFunc) The only difference is when myFunc is called, pre hands the query over to the function, whereas post hands the results to the function. There is also a "on_delete" that is the same as "post_delete", just providing a more natural syntax. -Thadeus On Thu, Apr 8, 2010 at 5:55 AM, DenesL <denes1...@yahoo.ca> wrote: > Except from being less verbose, how is this different from calling > somefunc under form.accepts? > > form=SQLFORM(...) # create, update or delete > if form.accepts(...): > somefunc(...) > > > On Apr 8, 5:34 am, Ishbir <ishbi...@gmail.com> wrote: >> The way that you are doing it in crud, do the same way in DAL. The >> only difference that create_onaccept function will be called if >> db.table.insert() is called whether directly or indirectly (via a crud >> form for e.g.) and the same applies for update and delete. >> >> In db.py, it could be something like- >> >> db.table.create_onaccept = somefunc >> >> where somefuc is a function in the form of- >> >> def somefunc(record_inserted): >> # increment/decrement something here >> pass >> >> What do you think? > > -- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to web...@googlegroups.com. > To unsubscribe from this group, send email to > web2py+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.