On Apr 8, 10:50 am, Thadeus Burgess <[email protected]> wrote:
> I have proposed a signal/slot system for the new DAL.

when? I may have missed or forgotten about this. I would be in favor
of this but I would like to see a complete naming scheme and
understand how do you handle the case when two functions are regitered
for the same function. How do you handle the order?

> 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 <[email protected]> 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 <[email protected]> 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 [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to