Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #30 (closed defect: fixed)

Opened 14 years ago

Last modified 12 years ago

Flash message should appear on current request if something is sent

Reported by: kevin Owned by: anonymous
Priority: high Milestone: 0.9
Component: TurboGears Version:
Severity: normal Keywords:
Cc:

Description

If a template or JSON is sent on the same request that a flash message is set, that message should be sent along to the template rather than set as a cookie.

Attachments

ticket_30-flash_current_request.diff Download (1.2 KB) - added by seancazzell@… 14 years ago.
Patch for controllers.get_flash()
ticket_30-flash_current_request_private.diff Download (1.9 KB) - added by seancazzell@… 14 years ago.
Modified patch that renames get_flash to _get_flash and makes it private

Change History

Changed 14 years ago by seancazzell@…

Patch for controllers.get_flash()

comment:1 Changed 14 years ago by seancazzell@…

This patch makes get_flash a little more clever. If the request has a tg_flash cookie, that will be returned. A clearing cookie will then be sent unless a new tg_flash message has already been sent in the response (we don't want to delete it).

If the request doesn't have a flash, but the response does, we return that and prevent the cookie from being sent to the browser.

Finally, None is returned if neither request nor response have a flash cookie.

comment:2 Changed 14 years ago by seancazzell@…

I just noticed get_flash is being exported in all - my patch makes calling get_flash have side effects (it should only be called once per request), so if it is applied we should also make get_flash private and call it _get_flash.

Currently, only _process_output calls get_flash().

Changed 14 years ago by seancazzell@…

Modified patch that renames get_flash to _get_flash and makes it private

comment:3 Changed 14 years ago by kevin

  • Status changed from new to assigned

comment:4 Changed 14 years ago by kevin

  • Status changed from assigned to closed
  • Resolution set to fixed

patch applied in [199]

Note: See TracTickets for help on using tickets.