From 4366bb392a5d41373d0a87c98a75eed59ceffd60 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Thu, 21 Mar 2013 21:04:06 +0000 Subject: [PATCH 1/6] Documented new signal message_flashed --- CHANGES | 1 + docs/api.rst | 8 ++++++++ docs/signals.rst | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/CHANGES b/CHANGES index bbf51704..ea7be9a7 100644 --- a/CHANGES +++ b/CHANGES @@ -51,6 +51,7 @@ Release date to be decided. as intended with domain names. - Changed logic for picking defaults for cookie values from sessions to work better with Google Chrome. +- Added `message_flashed` signal that simplifies flashing testing. Version 0.9 ----------- diff --git a/docs/api.rst b/docs/api.rst index 12e4b966..6e08241e 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -524,6 +524,14 @@ Signals An `exc` keyword argument is passed with the exception that caused the teardown. +.. data:: message_flashed + + This signal is sent when the application is flashing a message. The + messages is sent as `message` keyword argument and the category as + `category`. + + .. versionadded:: 0.10 + .. currentmodule:: None .. class:: flask.signals.Namespace diff --git a/docs/signals.rst b/docs/signals.rst index 5f0af048..4d96cc14 100644 --- a/docs/signals.rst +++ b/docs/signals.rst @@ -291,4 +291,22 @@ The following signals exist in Flask: This will also be passed an `exc` keyword argument that has a reference to the exception that caused the teardown if there was one. +.. data:: flask.message_flashed + :noindex: + + This signal is sent when the application is flashing a message. The + messages is sent as `message` keyword argument and the category as + `category`. + + Example subscriber:: + + recorded = [] + def record(sender, message, category, **extra): + recorded.append((message, category)) + + from flask import message_flashed + message_flashed.connect(record, app) + + .. versionadded:: 0.10 + .. _blinker: http://pypi.python.org/pypi/blinker From 78ae0ec7f8d436df789d98c64e3579a196f52ada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Kalkosi=C5=84ski?= Date: Mon, 25 Mar 2013 12:29:28 +0100 Subject: [PATCH 2/6] Add import to jsonify example. --- flask/json.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flask/json.py b/flask/json.py index a85bdc63..f25b11b1 100644 --- a/flask/json.py +++ b/flask/json.py @@ -141,6 +141,8 @@ def jsonify(*args, **kwargs): to this function are the same as to the :class:`dict` constructor. Example usage:: + + from flask import jsonify @app.route('/_get_current_user') def get_current_user(): From 1723990aee6ef4587d851081c36b824418549266 Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 26 Mar 2013 21:23:55 +0000 Subject: [PATCH 3/6] Fixed a few typos on quickstart --- docs/quickstart.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index f79a991f..b455e070 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -54,7 +54,7 @@ So what did that code do? 5. Finally we use the :meth:`~flask.Flask.run` function to run the local server with our application. The ``if __name__ == '__main__':`` makes sure the server only runs if the script is executed directly from the Python - interpreter and not used as imported module. + interpreter and not used as an imported module. To stop the server, hit control-C. @@ -143,8 +143,8 @@ Variable Rules `````````````` To add variable parts to a URL you can mark these special sections as -````. Such a part is then passed as keyword argument to your -function. Optionally a converter can be specified by specifying a rule with +````. Such a part is then passed as a keyword argument to your +function. Optionally a converter can be used by specifying a rule with ````. Here are some nice examples:: @app.route('/user/') @@ -191,10 +191,10 @@ The following converters exist: rather like the pathname of a file on UNIX-like systems. Accessing the URL with a trailing slash will produce a 404 "Not Found" error. - This behavior allows relative URLs to continue working if users access the - page when they forget a trailing slash, consistent with how Apache - and other servers work. Also, the URLs will stay unique, which helps search - engines avoid indexing the same page twice. + This behavior allows relative URLs to continue working even if the trailing + slash is ommited, consistent with how Apache and other servers work. Also, + the URLs will stay unique, which helps search engines avoid indexing the + same page twice. .. _url-building: From d1bf82b0f4b180ac7523a7b7e63e7246039d4e71 Mon Sep 17 00:00:00 2001 From: Jason Moon Date: Sun, 14 Apr 2013 00:10:38 -0700 Subject: [PATCH 4/6] Fixed typo in URL Processor documentation --- docs/patterns/urlprocessors.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/patterns/urlprocessors.rst b/docs/patterns/urlprocessors.rst index 778a5a6b..3f65d758 100644 --- a/docs/patterns/urlprocessors.rst +++ b/docs/patterns/urlprocessors.rst @@ -65,7 +65,7 @@ dictionary and put it somewhere else:: def pull_lang_code(endpoint, values): g.lang_code = values.pop('lang_code', None) -That way you no longer have to do the `lang_code` assigment to +That way you no longer have to do the `lang_code` assignment to :data:`~flask.g` in every function. You can further improve that by writing your own decorator that prefixes URLs with the language code, but the more beautiful solution is using a blueprint. Once the From 1358fd9f3e0d1cdfa2a948a1176b276188ea959e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cenk=20Alt=C4=B1?= Date: Wed, 24 Apr 2013 09:42:52 +0300 Subject: [PATCH 5/6] Syntax highlighting for PyPI long description --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 4a9182b9..2f9c95ca 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ intentions. And before you ask: It's BSD licensed! Flask is Fun ```````````` -:: +.. code:: python from flask import Flask app = Flask(__name__) @@ -23,7 +23,7 @@ Flask is Fun And Easy to Setup ````````````````` -:: +.. code:: bash $ pip install Flask $ python hello.py From a9b22af9bc77fb89047faa45090dc39631c2d0d5 Mon Sep 17 00:00:00 2001 From: Akshar Raaj Date: Fri, 3 May 2013 17:41:43 +0530 Subject: [PATCH 6/6] Fixed documentation in 'Design Decisions in Flask' --- docs/design.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/design.rst b/docs/design.rst index ee83840e..f0f7126d 100644 --- a/docs/design.rst +++ b/docs/design.rst @@ -82,7 +82,7 @@ things (:ref:`app-factories`). The Routing System ------------------ -Flask uses the Werkzeug routing system which has was designed to +Flask uses the Werkzeug routing system which was designed to automatically order routes by complexity. This means that you can declare routes in arbitrary order and they will still work as expected. This is a requirement if you want to properly implement decorator based routing