On Jul 9, 2011, at 1:50 PM, Jim Karsten wrote:
> "You could check whether there's something in response.flash and not clobber 
> it, if you liked." Do this in a models file, for example?

No, it's done before the models. When the request comes in, the core logic does:

response.flash = session.flash  # normally None
session.flash = None

Something like this:

def controller1():
    form = SQLFORM.factory(Field('myfield'))                                    
    if form.accepts(request.vars,session):                                      
        response.flash = 'Record updated'                                       
    elif form.errors:                                                           
        response.flash = 'Form contains errors'                                 
    elif not response flash:                                                    
                   
        response.flash = 'Please fill in the form'                              
    return dict(form=form)                                                      
                                                                                
def controller2():                                                              
    session.flash = 'Message from session flash.'                               
    redirect(URL('controller1'))    

Reply via email to