It's not a GAE issue. The controller's code: # coding: utf8
######################################################################### ## This is a samples controller ## - index is the default action of any application ## - user is required for authentication and authorization ## - download is for downloading files uploaded in the db (does streaming) ## - call exposes all registered services (none by default) ######################################################################### def index(): session.estate_id = False estates = db(db.estate.id>0).select(orderby=~db.estate.price) return dict(estates=estates) def assign_estate_id(form): form.vars.estate_id = session.estate_id #...@auth.requires_login() def create_estate(): form = SQLFORM(db.estate) if form.accepts(request.vars, session): response.flash = T('The estate was successfully created.') return dict(form=form) #...@auth.requires_login() def edit_estate(): if len(request.args): records = db(db.estate.id==request.args[0]).select() if len(request.args) and len(records): url = URL(r=request, f='create_image') link = URL(r=request, f='index') form = SQLFORM(db.estate, records[0], deletable=False) if form.accepts(request.vars, session): session.flash = T('The estate were successfully edit.') redirect(URL(r=request,args=request.args)) else: redirect(URL(r=request, f='index')) return dict(form=form, estate=records[0]) #...@auth.requires_login() def delete_estate(): if db(db.estate.id==request.args(0)).delete(): session.flash = T('The estate was successfully deleted.') redirect(URL(r=request, f='index')) #...@auth.requires_login() def create_image(): estates = None if not session.estate_id: estates = db(db.estate.id==request.vars.estate_id).select() try: session.estate_id = estates[0].id except: session.flash = T('Please choose a valid estate') redirect(URL(r=request, f='index')) form = SQLFORM(db.image) if form.accepts(request.vars, session, onvalidation = assign_estate_id(form)): response.flash = T('The images were successfully uploaded.') elif form.errors: response.flash = T('Erros occured during the upload process') if not estates: estates = db(db.estate.id==session.estate_id).select() images = db(db.image.estate_id==session.estate_id).select (orderby=db.image.priority) return dict(form=form, images=images, estate=estates[0]) #...@auth.requires_login() def delete_image(): if db(db.image.id==request.args(0)).delete(): session.flash = T('The image was successfully deleted.') redirect(URL(r=request, f='create_image')) #...@auth.requires_login() def edit_image(): if len(request.args): records = db(db.image.id==request.args[0]).select() if len(request.args) and len(records): url = URL(r=request, f='create_image') link = URL(r=request, f='index') form = SQLFORM(db.image, records[0], deletable=False) if form.accepts(request.vars, session, onvalidation = assign_estate_id): session.flash = T('The images were successfully edit.') redirect(URL(r=request,args=request.args)) else: redirect(URL(r=request, f='create_image')) return dict(form=form, image=records[0]) On Sep 16, 9:51 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > I need to see the assign_estate_id source and the full body of > controller actions. > I do not think this is a bug, I think this a workflow issue. > > Or are you saying it behaves differently on GAE and non-GAE? > > Massimo > > On Sep 16, 1:32 pm, Vidul Petrov <vidul.r...@gmail.com> wrote: > > > > > For example: > > > # this works: > > def create_image(): > > ... > > if form.accepts(request.vars, session, > > onvalidation = assign_estate_id(form)): > > > # this does not work until the "delete_image" method redirects to the > > "create_image" method: > > if form.accepts(request.vars, session, > > onvalidation = assign_estate_id): > > > def delete_image(): > > if db(db.image.id==request.args(0)).delete(): > > session.flash = T('The image was successfully deleted.') > > > redirect(URL(r=request, f='create_image')) > > > I know that this is not the case with relational databases, but I am > > using GAE for this application. > > > On Sep 16, 4:05 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > Can you show an example of what you mean? I do not think what you say > > > is the case. > > > > On Sep 16, 5:22 am, Vidul Petrov <vidul.r...@gmail.com> wrote: > > > > > Hi all, > > > > > There is a problem with "onvalidation" - it works only after redirect > > > > unless the form object is explicitly given: > > > > > onvalidation = assign_some_value_to_a_var(form) > > > > > Is this a bug or the new behavior of "onvalidation"? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" 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 -~----------~----~----~----~------~----~------~--~---