From c93ea5551c6928745414f186ef465e2699a6833b Mon Sep 17 00:00:00 2001 From: Ron DuPlain Date: Mon, 16 Jan 2012 23:16:43 -0500 Subject: [PATCH] Keep flashed message examples in one place. --- docs/patterns/flashing.rst | 23 ++++++++++++----------- flask/helpers.py | 25 +------------------------ 2 files changed, 13 insertions(+), 35 deletions(-) diff --git a/docs/patterns/flashing.rst b/docs/patterns/flashing.rst index be8fcfe8..f3d80d32 100644 --- a/docs/patterns/flashing.rst +++ b/docs/patterns/flashing.rst @@ -129,14 +129,15 @@ render each category in a separate block. .. sourcecode:: html+jinja -{% with errors = get_flashed_messages(category_filter=["error"]) %} - {% if errors %} -
- -
- {% endif %} -{% endwith %} \ No newline at end of file + {% with errors = get_flashed_messages(category_filter=["error"]) %} + {% if errors %} +
+ × + +
+ {% endif %} + {% endwith %} diff --git a/flask/helpers.py b/flask/helpers.py index 56c59199..25250d26 100644 --- a/flask/helpers.py +++ b/flask/helpers.py @@ -281,30 +281,7 @@ def get_flashed_messages(with_categories=False, category_filter=[]): * `category_filter` filters the messages down to only those matching the provided categories. - Example usage: - - .. sourcecode:: html+jinja - - {% for category, msg in get_flashed_messages(with_categories=true) %} -

{{ msg }} - {% endfor %} - - Example usage similar to http://twitter.github.com/bootstrap/#alerts: - - .. sourcecode:: html+jinja - - {% with errors = get_flashed_messages(category_filter=["error"]) %} - {% if errors %} -

- × - -
- {% endif %} - {% endwith %} + See :ref:`message-flashing-pattern` for examples. .. versionchanged:: 0.3 `with_categories` parameter added.