watsonpy / watson-framework

A Python 3 web app framework.
BSD 3-Clause "New" or "Revised" License
104 stars 12 forks source link

flash_messages and PRG #3

Closed SabatierBoris closed 10 years ago

SabatierBoris commented 10 years ago

If we add some flash messages on in a controler's method, and after we redirect to another page. The flash messages will be not automaticaly retrieved.

It's because flash messages are retrieved form the sessions by "HttpMixin.flash_messages"

So a work around is to juste call "self.flash_message" in the controller method.

The documentation (http://watson-framework.readthedocs.org/en/latest/common-usage/controllers.html#flash-messaging) say it should be done automaticaly.

I think it's can be solve by call self.flash_message in the init of HttpMixin (or something like this)

simoncoulton commented 10 years ago

Resolved in 3d6e9daecc9dec6821ca599338ce7597599c059b (2.2.3). Depending on the session storage used, it wasn't being written to the storage itself. The relevant tests now also support this.

More specifically at https://github.com/watsonpy/watson-framework/blob/2.2.3/watson/framework/controllers.py#L310