This last update break my application,
now my function
### Controller ####
@auth.requires_login()
def customcreate():
try:
if session.create:
pass
except:
session.create=[]
try:
form = crud.create('databasedp',onvalidation=lambda form:r
(form), onaccept=lambda form: f(form)) #i just put this here to debug
except Exception, inst:
print inst
return dict(form=form)
def f(form):
if session.create:
session.create.append(form.vars.id)
else:
session.create=[form.vars.id]
def r(form):
form.vars.total_payd=form.vars.total_amount-form.vars.total_credit
################################################################
Always return
#####
(303, 'You are being redirected <a href="/Dominos_Times/default/
index">here</a>'
, {'Content-Type': 'text/html', 'Location': '/Dominos_Times/default/
index'})
###
But work fine in before this last update!
On 8 Jun, 12:45, mdipierro <[email protected]> wrote:
> in thunk in 5 minutes
>
> crud.settings.keepvalues=True before calling crud.update()
>
> On Jun 8, 5:14 am, NewBeen <[email protected]> wrote:
>
> > Greetings,
>
> > How can i do this put keepvalues=True when i use the function
> > crud.create()
>
> > i already try:
>
> > ### CODE ###
>
> > form = crud.create('databasedp',onvalidation=lambda form:r(form))
>
> > def r(form):
> > if form.accepts(request.vars,session,keepvalues=True):
> > response.flash="Accept form"
>
> > ### END ###
>
> > and
>
> > ### CODE ###
>
> > form = crud.create('databasedp', onaccept=lambda form: f(form))
>
> > def f(form):
> > if form.accepts(request.vars,session,keepvalues=True):
> > response.flash="Accept form"
>
> > #### END ####
>
> > But nothing of this work :( any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---