mitsuhiko/flask — pull request #336 by steve918 (2011-10-17 02:51:51+00:00)
Title: Allow category filtering in get_flashed_messages to allow rending categories in separate html blocks

I found it a bit difficult to render separate html blocks for individual flash categories similar to bootstrap: http://twitter.github.com/bootstrap/#alerts.

This patch allows you to filter flash categories via a list. So you can do something like:

{%- for msg in get_flashed_messages(category_filter=["error"]) %}

×

{{ msg }}

{% endfor -%}

{%- for msg in get_flashed_messages(category_filter=["warning"]) %}

×

{{ msg }}

{% endfor -%}

{%- for msg in get_flashed_messages(category_filter=["success"]) %}

×

{{ msg }}

{% endfor -%}

{%- for msg in get_flashed_messages(category_filter=["info"]) %}

×

{{ msg }}

{% endfor -%}

Cheers,
Steven