the problem with

f() and g()

is that g() gets executed if and only if f() returns true.
You can do

onaccept=lambda form: (f(form),g(form))

Massimo

On Jan 13, 6:12 am, vihang <vihan...@gmail.com> wrote:
> I ended doing the same, clubbing them into two functions. But I was
> just curious why it does not work as mentioned above.
>
> But Thanks.
>
> On Jan 13, 3:53 pm, notabene <ni...@bjerre.net> wrote
>
> > On Jan 13, 11:00 am, vihang <vihan...@gmail.com> wrote:
>
> > > hi,
>
> > > I am trying to execute this
>
> > > def add():
> > >     return dict(form=t2.create(db.Accomodation, onaccept=lambda form:\
> > >     t2.add_access(db.Accomodation,form.vars.id)\
> > >     and db.listing_owner.insert(person_id=t2.person_id,
> > > Accomodation_id=form.vars.id)\
> > >     and listing(form.vars.id)\
> > >     and img_conv(form.vars.id)))
>
> > > but only the first three function in the lambda gets executed. I tried
> > > various permutations, but its always the first three functions only.
> > > Is it a bug or a feature or restriction?
>
> > > Thanks in advance
> > > Vihang
>
> > Try something like this:
>
> > return dict(form=t2.create(db.Accomodation, onaccept=lambda form: f
> > (form))
>
> > def f(form):
> >     t2.add_access(db.Accomodation,form.vars.id)
> >     db.listing_owner.insert
> > (person_id=t2.person_id,Accomodation_id=form.vars.id)
> >     listing(form.vars.id)
> >     img_conv(form.vars.id)
>
> > Regards Niels
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to