[web2py] Prevent response.flash when there is a session.flash in case of multiples components

26 views
Skip to first unread message

Richard

unread,
Nov 13, 2015, 4:41:57 PM11/13/15
to web2py-users
Hello,

I try to manage flash message properly with a bunch of related form components embeded into a web2py controller/page...

To me the best option would be to check if session.flash is empty and if so set a response.flash though this is not possible since session.flash seems to get cleared out before the load of components once the page reload...

Example:

elif form.errors:
        response.flash = 'form has errors'
else:
    if session.flash:
        # pass
        print session.flash  # Nothing
    else:
        response.flash = T('please fill the form')

This was just a test, but as said above session.flash seems always empty once there in the code execution.

Thanks

Richard
Reply all
Reply to author
Forward
0 new messages