may be a dictionary of tablename_event:function

I see that in DAL level this is very complicated.

but what about the resquest-response workflow events. I had cases where I
needed some global  function to trigger before/after the template rendering
and final response.

http://zerp.ly/rochacbruno
Em 11/10/2011 19:42, "Massimo Di Pierro" <massimo.dipie...@gmail.com>
escreveu:

> the problem with this is not the names. ;-)
>
> Consider the case of preupdate and onupdate.
>
>   db(db.person.age>18).update(can_drink=True)
>
> What information should be passed to preupdate and update? tablename?
> query? {'can_drink':True}? Number of affected records? Should there be
> one onselect per table? We do not want to call onupdate for every
> table, do we (performance issues)?
>
> What about?
>
>   db(db.person.id=2).update(can_drink=True)
>
> What about
>
>
> db(db.person).select(left=db.dog.on(db.dog.owner==db.person.id
> ),limitby=(0,1))
>
> What should we pass to onselect? query? left? limitby? all arguments?
> number of returned records? returned records? In this case we cannot
> pass one table because because more than one table may be involved.
>
> Every one of those callbacks would need a different signature. It
> would not be obvious and I am not sure people would agree.
> I do not oppose to this. I just want to hear more from you.
>
> Massimo
>
>
>
> On Oct 11, 4:57 pm, Bruno Rocha <rochacbr...@gmail.com> wrote:
> > Would be nice to have some global events in web2py workflow. I can
> imagine
> > some useful hooks:
> >
> > workflow global events:
> >
> > onrequest # before the execution of action/model
> >
> > prerender # after the execution of action/model but before the view
> > rendering
> >
> > onrender # after the view render but before the output
> >
> > onresponse # after all the request process finished.
> >
> > DAL global events:
> >
> > preselect - onselect
> > preinsert - oninsert
> > preupdate - onupdate
> > predelete - ondelete
> >
> > ASPnet has some usefull event system (oninit, onload, pageload etc..)
> >
> > I dont even know if it is possible to trigger all of them in web2py and
> how
> > can it cost. but would be nice to have it.
> >
> > http://zerp.ly/rochacbruno
> > Em 11/10/2011 17:23, "Massimo Di Pierro" <massimo.dipie...@gmail.com>
> > escreveu:
> >
> >
> >
> >
> >
> >
> >
> > > Not yet at the db level but at the form level:
> >
> > > form=SQLFORM(...).process(onsuccess=lambda form:...)
> >
> > > On Oct 11, 3:11 am, Manuele <manuele.pese...@gmail.com> wrote:
> > > > Hi,
> > > > is there a way to trigger some functions on database eventes, for
> > > > example on new record?
> >
> > > > thanks a lot
> >
> > > >      Manuele

Reply via email to