From 2c29495e6dca548e479a52e6be364639f57f9a81 Mon Sep 17 00:00:00 2001 From: David Lord Date: Mon, 7 Jan 2019 13:09:36 -0800 Subject: [PATCH 01/16] remove encoding from method override pattern --- docs/patterns/methodoverrides.rst | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/patterns/methodoverrides.rst b/docs/patterns/methodoverrides.rst index d5c187b6..45dbb87e 100644 --- a/docs/patterns/methodoverrides.rst +++ b/docs/patterns/methodoverrides.rst @@ -2,14 +2,14 @@ Adding HTTP Method Overrides ============================ Some HTTP proxies do not support arbitrary HTTP methods or newer HTTP -methods (such as PATCH). In that case it's possible to “proxy” HTTP +methods (such as PATCH). In that case it's possible to "proxy" HTTP methods through another HTTP method in total violation of the protocol. The way this works is by letting the client do an HTTP POST request and -set the ``X-HTTP-Method-Override`` header and set the value to the -intended HTTP method (such as ``PATCH``). +set the ``X-HTTP-Method-Override`` header. Then the method is replaced +with the header value before being passed to Flask. -This can easily be accomplished with an HTTP middleware:: +This can be accomplished with an HTTP middleware:: class HTTPMethodOverrideMiddleware(object): allowed_methods = frozenset([ @@ -29,13 +29,12 @@ This can easily be accomplished with an HTTP middleware:: def __call__(self, environ, start_response): method = environ.get('HTTP_X_HTTP_METHOD_OVERRIDE', '').upper() if method in self.allowed_methods: - method = method.encode('ascii', 'replace') environ['REQUEST_METHOD'] = method if method in self.bodyless_methods: environ['CONTENT_LENGTH'] = '0' return self.app(environ, start_response) -To use this with Flask this is all that is necessary:: +To use this with Flask, wrap the app object with the middleware:: from flask import Flask From 8c979698bd9942a525dbb0e1ef4a31269a0b04cb Mon Sep 17 00:00:00 2001 From: venus Date: Sat, 12 Jan 2019 14:51:04 +0800 Subject: [PATCH 02/16] fix the typo --- docs/extensiondev.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/extensiondev.rst b/docs/extensiondev.rst index f48fb46b..aa4eff76 100644 --- a/docs/extensiondev.rst +++ b/docs/extensiondev.rst @@ -240,7 +240,7 @@ automatically. Additionally, the ``init_app`` method is used to support the factory pattern for creating apps:: - db = Sqlite3() + db = SQLite3() # Then later on. app = create_app('the-config.cfg') db.init_app(app) From d838f1c91815510ecf98131a83541847a751efa8 Mon Sep 17 00:00:00 2001 From: Grey Li Date: Wed, 6 Mar 2019 10:34:21 +0800 Subject: [PATCH 03/16] doc: Improve description for valid view func return value * improve wording. * remove unnecessary spaces. --- docs/quickstart.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 8f055d40..0db9750a 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -683,10 +683,10 @@ converting return values into response objects is as follows: returned from the view. 2. If it's a string, a response object is created with that data and the default parameters. -3. If a tuple is returned the items in the tuple can provide extra - information. Such tuples have to be in the form ``(response, status, - headers)`` or ``(response, headers)`` where at least one item has - to be in the tuple. The ``status`` value will override the status code +3. If a tuple is returned the items in the tuple can provide extra information. + Such tuples have to be in the form ``(response, status, headers)``, + ``(response, headers)`` or ``(response, status)`` where at least one item + has to be in the tuple. The ``status`` value will override the status code and ``headers`` can be a list or dictionary of additional header values. 4. If none of that works, Flask will assume the return value is a valid WSGI application and convert that into a response object. From 4df7b220fa1f2473dae316a4543fb71e23576a07 Mon Sep 17 00:00:00 2001 From: Grey Li Date: Fri, 12 Apr 2019 09:45:58 +0800 Subject: [PATCH 04/16] Fix typo in URL defaults example --- docs/api.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api.rst b/docs/api.rst index 33bcd8c1..c3eda1cf 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -726,7 +726,7 @@ requests, make sure the default route only handles ``GET``, as redirects can't preserve form data. :: @app.route('/region/', defaults={'id': 1}) - @app.route('/region/', methods=['GET', 'POST']) + @app.route('/region/', methods=['GET', 'POST']) def region(id): pass From 29a47ae6ea51e672ea841f7869baa8dffe3291bc Mon Sep 17 00:00:00 2001 From: Peter Landoll Date: Mon, 6 May 2019 09:39:25 -0400 Subject: [PATCH 05/16] Add link to official Discord chat server --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index 6277690e..0b4e628f 100644 --- a/README.rst +++ b/README.rst @@ -69,6 +69,7 @@ Links * Windows: https://ci.appveyor.com/project/pallets/flask * Test coverage: https://codecov.io/gh/pallets/flask +* Official chat: https://discord.gg/t6rrQZH .. _WSGI: https://wsgi.readthedocs.io .. _Werkzeug: https://www.palletsprojects.com/p/werkzeug/ From 205c943deda542b0c0df2f1b9ce3bbe72d80eef8 Mon Sep 17 00:00:00 2001 From: Sebastian Jakubiak Date: Mon, 13 May 2019 22:07:37 +0200 Subject: [PATCH 06/16] Fix misplaced paren in docs --- flask/ctx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask/ctx.py b/flask/ctx.py index 8472c920..ec8e787e 100644 --- a/flask/ctx.py +++ b/flask/ctx.py @@ -170,7 +170,7 @@ def has_request_context(): self.remote_addr = remote_addr Alternatively you can also just test any of the context bound objects - (such as :class:`request` or :class:`g` for truthness):: + (such as :class:`request` or :class:`g`) for truthness:: class User(db.Model): From d23b160e6df5d13e7db7a5e53afab6db306efe3c Mon Sep 17 00:00:00 2001 From: RyanSquared Date: Tue, 12 Feb 2019 11:58:18 -0600 Subject: [PATCH 07/16] helpers.py: Fix docs of url_for(..., _external=True) --- flask/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask/helpers.py b/flask/helpers.py index 24c8a5da..158edc5c 100644 --- a/flask/helpers.py +++ b/flask/helpers.py @@ -276,7 +276,7 @@ def url_for(endpoint, **values): :param values: the variable arguments of the URL rule :param _external: if set to ``True``, an absolute URL is generated. Server address can be changed via ``SERVER_NAME`` configuration variable which - defaults to `localhost`. + falls back to the `Host` header, then to the IP and port of the request. :param _scheme: a string specifying the desired URL scheme. The `_external` parameter must be set to ``True`` or a :exc:`ValueError` is raised. The default behavior uses the same scheme as the current request, or From 800c744fe7236175cbf0bbbc1a152899897579df Mon Sep 17 00:00:00 2001 From: jordan bonser Date: Sat, 9 Mar 2019 00:41:57 +0000 Subject: [PATCH 08/16] improve env vars config example --- docs/config.rst | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/docs/config.rst b/docs/config.rst index 0397da6e..81e580ca 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -437,6 +437,7 @@ methods on the config object as well to load from individual files. For a complete reference, read the :class:`~flask.Config` object's documentation. + Configuring from Environment Variables -------------------------------------- @@ -448,15 +449,13 @@ Environment variables can be set on Linux or OS X with the export command in the shell before starting the server:: $ export SECRET_KEY='5f352379324c22463451387a0aec5d2f' - $ export DEBUG=False + $ export MAIL_ENABLED=false $ python run-app.py * Running on http://127.0.0.1:5000/ - * Restarting with reloader... -On Windows systems use the `set` builtin instead:: +On Windows systems use the ``set`` builtin instead:: >set SECRET_KEY='5f352379324c22463451387a0aec5d2f' - >set DEBUG=False While this approach is straightforward to use, it is important to remember that environment variables are strings -- they are not automatically deserialized @@ -464,17 +463,15 @@ into Python types. Here is an example of a configuration file that uses environment variables:: - # Example configuration import os - ENVIRONMENT_DEBUG = os.environ.get("DEBUG", default=False) - if ENVIRONMENT_DEBUG.lower() in ("f", "false"): - ENVIRONMENT_DEBUG = False + _mail_enabled = os.environ.get("MAIL_ENABLED", default="true") + MAIL_ENABLED = _mail_enabled.lower() in {"1", "t", "true"} + + SECRET_KEY = os.environ.get("SECRET_KEY") - DEBUG = ENVIRONMENT_DEBUG - SECRET_KEY = os.environ.get("SECRET_KEY", default=None) if not SECRET_KEY: - raise ValueError("No secret key set for Flask application") + raise ValueError("No SECRET_KEY set for Flask application") Notice that any value besides an empty string will be interpreted as a boolean @@ -486,6 +483,7 @@ ability to access the configuration when starting up. There are other methods on the config object as well to load from individual files. For a complete reference, read the :class:`~flask.Config` class documentation. + Configuration Best Practices ---------------------------- From 62fe1563ad6805decc51fb3d682064249deddb96 Mon Sep 17 00:00:00 2001 From: Abdur-Rahmaan Janhangeer Date: Wed, 3 Apr 2019 12:47:01 +0400 Subject: [PATCH 09/16] Update CONTRIBUTING.rst --- CONTRIBUTING.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 36b7df3a..387d8dae 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -11,6 +11,7 @@ resources for questions about your own code: * The IRC channel ``#pocoo`` on FreeNode. * The IRC channel ``#python`` on FreeNode for more general questions. +* Our Discord server is here: `https://discordapp.com/invite/3TDRQsx`_ * The mailing list flask@python.org for long term discussion or larger issues. * Ask on `Stack Overflow`_. Search with Google first using: ``site:stackoverflow.com flask {search term, exception message, etc.}`` @@ -39,6 +40,7 @@ Submitting patches without your patch. - Try to follow `PEP8`_, but you may ignore the line length limit if following it would make the code uglier. +- We don't accept style-related patches. First time setup ~~~~~~~~~~~~~~~~ From 5e41e409bca42a8fef7b4460adfc76bf432824da Mon Sep 17 00:00:00 2001 From: David Lord Date: Thu, 16 May 2019 09:47:56 -0700 Subject: [PATCH 10/16] fix discord link, clean up --- CONTRIBUTING.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 387d8dae..44bb53d5 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -9,9 +9,9 @@ Support questions Please, don't use the issue tracker for this. Use one of the following resources for questions about your own code: -* The IRC channel ``#pocoo`` on FreeNode. -* The IRC channel ``#python`` on FreeNode for more general questions. -* Our Discord server is here: `https://discordapp.com/invite/3TDRQsx`_ +* The ``#get-help`` channel on our Discord chat: https://discord.gg/t6rrQZH + * The IRC channel ``#pocoo`` on FreeNode is linked to Discord, but + Discord is preferred. * The mailing list flask@python.org for long term discussion or larger issues. * Ask on `Stack Overflow`_. Search with Google first using: ``site:stackoverflow.com flask {search term, exception message, etc.}`` @@ -40,7 +40,6 @@ Submitting patches without your patch. - Try to follow `PEP8`_, but you may ignore the line length limit if following it would make the code uglier. -- We don't accept style-related patches. First time setup ~~~~~~~~~~~~~~~~ From e5b0fe68414cd3af9c1e91c82fa0c0ef4145c8c2 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sat, 23 Mar 2019 23:10:36 +0000 Subject: [PATCH 11/16] Fix some HTML injection paths in examples These are unlikely to be copy-pasted by users but it's best practice to avoid it and other examples do. --- docs/quickstart.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 0db9750a..625f1787 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -203,7 +203,7 @@ of the argument like ````. :: @app.route('/user/') def show_user_profile(username): # show the user profile for that user - return 'User %s' % username + return 'User %s' % escape(username) @app.route('/post/') def show_post(post_id): @@ -213,7 +213,7 @@ of the argument like ````. :: @app.route('/path/') def show_subpath(subpath): # show the subpath after /path/ - return 'Subpath %s' % subpath + return 'Subpath %s' % escape(subpath) Converter types: @@ -279,7 +279,7 @@ to try out :func:`~flask.url_for`. :meth:`~flask.Flask.test_request_context` tells Flask to behave as though it's handling a request even while we use a Python shell. See :ref:`context-locals`. :: - from flask import Flask, url_for + from flask import Flask, escape, url_for app = Flask(__name__) @@ -293,7 +293,7 @@ Python shell. See :ref:`context-locals`. :: @app.route('/user/') def profile(username): - return '{}\'s profile'.format(username) + return '{}\'s profile'.format(escape(username)) with app.test_request_context(): print(url_for('index')) From 994cd1db33d55b48f1d99aa97ac7b2adaa89cbaf Mon Sep 17 00:00:00 2001 From: Tom-McDonald Date: Sun, 7 Apr 2019 12:48:58 +0100 Subject: [PATCH 12/16] replaced deprecated sample code in proxy-setup docs --- docs/deploying/wsgi-standalone.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/deploying/wsgi-standalone.rst b/docs/deploying/wsgi-standalone.rst index 5b0740a6..c2757420 100644 --- a/docs/deploying/wsgi-standalone.rst +++ b/docs/deploying/wsgi-standalone.rst @@ -124,8 +124,8 @@ If your httpd is not providing these headers, the most common setup invokes the host being set from ``X-Forwarded-Host`` and the remote address from ``X-Forwarded-For``:: - from werkzeug.contrib.fixers import ProxyFix - app.wsgi_app = ProxyFix(app.wsgi_app) + from werkzeug.middleware.proxy_fix import ProxyFix + app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1, x_host=1) .. admonition:: Trusting Headers From c2b4b745e946aece1bf253a29e6a1161ae14347d Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 23 Apr 2019 23:23:24 +0530 Subject: [PATCH 13/16] add more git commands to contributing doc --- CONTRIBUTING.rst | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 44bb53d5..0fdc18b1 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -82,14 +82,27 @@ First time setup Start coding ~~~~~~~~~~~~ -- Create a branch to identify the issue you would like to work on (e.g. - ``2287-dry-test-suite``) -- Using your favorite editor, make your changes, `committing as you go`_. +- Create a branch to identify the issue you would like to work on:: + + git branch your-branch-name + +- Then switch to make sure that we are working on that branch by using:: + + git checkout your-branch-name + +- Using your favorite editor, make your changes, `committing as you go`_ by using the following:: + + git add -A + git commit + - Try to follow `PEP8`_, but you may ignore the line length limit if following it would make the code uglier. - Include tests that cover any code changes you make. Make sure the test fails without your patch. `Run the tests. `_. -- Push your commits to GitHub and `create a pull request`_. +- Push your commits to GitHub and `create a pull request`_ by using:: + + git push --set-upstream origin your-branch-name + - Celebrate 🎉 .. _committing as you go: http://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html#commit-your-changes From e61fd5f6cb1c7ebba86a9eef9c5e645d9c4032d1 Mon Sep 17 00:00:00 2001 From: David Lord Date: Thu, 16 May 2019 10:21:35 -0700 Subject: [PATCH 14/16] add instructions for bug and feature branches --- CONTRIBUTING.rst | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 0fdc18b1..2f752e66 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -82,19 +82,18 @@ First time setup Start coding ~~~~~~~~~~~~ -- Create a branch to identify the issue you would like to work on:: +- Create a branch to identify the issue you would like to work on. If + you're submitting a bug or documentation fix, branch off of the + latest ".x" branch:: - git branch your-branch-name + git checkout -b your-branch-name origin/1.0.x -- Then switch to make sure that we are working on that branch by using:: + If you're submitting a feature addition or change, branch off of the + "master" branch:: - git checkout your-branch-name - -- Using your favorite editor, make your changes, `committing as you go`_ by using the following:: - - git add -A - git commit + git checkout -b your-branch-name origin/master +- Using your favorite editor, make your changes, `committing as you go`_. - Try to follow `PEP8`_, but you may ignore the line length limit if following it would make the code uglier. - Include tests that cover any code changes you make. Make sure the test fails From 0df2620c5f2fd9fa09224591952c36215cc4bda1 Mon Sep 17 00:00:00 2001 From: Charles Ross Date: Wed, 24 Apr 2019 11:17:33 -0700 Subject: [PATCH 15/16] update docs on gunicorn deploy and app discovery --- docs/cli.rst | 6 +++--- docs/deploying/wsgi-standalone.rst | 12 +++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/cli.rst b/docs/cli.rst index 6bae15db..a8dd8f24 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -68,9 +68,9 @@ parts: The ``create_app`` factory in ``hello`` is called with the string ``'dev'`` as the argument. -If ``FLASK_APP`` is not set, the command will look for a file called -:file:`wsgi.py` or :file:`app.py` and try to detect an application instance or -factory. +If ``FLASK_APP`` is not set, the command will try to import "app" or +"wsgi" (as a ".py" file, or package) and try to detect an application +instance or factory. Within the given import, the command looks for an application instance named ``app`` or ``application``, then any application instance. If no instance is diff --git a/docs/deploying/wsgi-standalone.rst b/docs/deploying/wsgi-standalone.rst index c2757420..a7719126 100644 --- a/docs/deploying/wsgi-standalone.rst +++ b/docs/deploying/wsgi-standalone.rst @@ -23,9 +23,15 @@ For example, to run a Flask application with 4 worker processes (``-w gunicorn -w 4 -b 127.0.0.1:4000 myproject:app -.. _Gunicorn: http://gunicorn.org/ -.. _eventlet: http://eventlet.net/ -.. _greenlet: https://greenlet.readthedocs.io/en/latest/ +The ``gunicorn`` command expects the names of your application module or +package and the application instance within the module. If you use the +application factory pattern, you can pass a call to that:: + + $ gunicorn "myproject:create_app()" + +.. _Gunicorn: https://gunicorn.org/ +.. _eventlet: https://eventlet.net/ + uWSGI -------- From 4e272fc042cab5505c3c5ae796caa6b06f9dae9d Mon Sep 17 00:00:00 2001 From: A Brooks Date: Tue, 14 May 2019 15:08:00 -0500 Subject: [PATCH 16/16] Fix various small spelling errors. --- docs/appcontext.rst | 2 +- docs/becomingbig.rst | 2 +- docs/blueprints.rst | 4 ++-- docs/config.rst | 6 +++--- docs/design.rst | 4 ++-- docs/extensiondev.rst | 2 +- docs/extensions.rst | 2 +- docs/shell.rst | 2 +- docs/unicode.rst | 4 ++-- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/appcontext.rst b/docs/appcontext.rst index 63006ad4..5f41535a 100644 --- a/docs/appcontext.rst +++ b/docs/appcontext.rst @@ -49,7 +49,7 @@ Typically, an application context will have the same lifetime as a request. See :doc:`/reqcontext` for more information about how the contexts work -and the full lifecycle of a request. +and the full life cycle of a request. Manually Push a Context diff --git a/docs/becomingbig.rst b/docs/becomingbig.rst index 0facbfee..16dea1da 100644 --- a/docs/becomingbig.rst +++ b/docs/becomingbig.rst @@ -96,6 +96,6 @@ Discuss with the community. The Flask developers keep the framework accessible to users with codebases big and small. If you find an obstacle in your way, caused by Flask, don't hesitate -to contact the developers on the mailinglist or IRC channel. The best way for +to contact the developers on the mailing list or IRC channel. The best way for the Flask and Flask extension developers to improve the tools for larger applications is getting feedback from users. diff --git a/docs/blueprints.rst b/docs/blueprints.rst index d3ab234c..e6003214 100644 --- a/docs/blueprints.rst +++ b/docs/blueprints.rst @@ -244,7 +244,7 @@ was dispatched to any other admin blueprint endpoint. Error Handlers -------------- -Blueprints support the errorhandler decorator just like the :class:`Flask` +Blueprints support the ``errorhandler`` decorator just like the :class:`Flask` application object, so it is easy to make Blueprint-specific custom error pages. @@ -259,7 +259,7 @@ concerning handlers for 404 and 405 exceptions. These errorhandlers are only invoked from an appropriate ``raise`` statement or a call to ``abort`` in another of the blueprint's view functions; they are not invoked by, e.g., an invalid URL access. This is because the blueprint does not "own" a certain URL space, so -the application instance has no way of knowing which blueprint errorhandler it +the application instance has no way of knowing which blueprint error handler it should run if given an invalid URL. If you would like to execute different handling strategies for these errors based on URL prefixes, they may be defined at the application level using the ``request`` proxy object:: diff --git a/docs/config.rst b/docs/config.rst index 81e580ca..1a89ffe5 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -9,7 +9,7 @@ toggling the debug mode, setting the secret key, and other such environment-specific things. The way Flask is designed usually requires the configuration to be -available when the application starts up. You can hardcode the +available when the application starts up. You can hard code the configuration in the code, which for many small applications is not actually that bad, but there are better ways. @@ -494,7 +494,7 @@ that experience: 1. Create your application in a function and register blueprints on it. That way you can create multiple instances of your application with - different configurations attached which makes unittesting a lot + different configurations attached which makes unit testing a lot easier. You can use this to pass in configuration as needed. 2. Do not write code that needs the configuration at import time. If you @@ -527,7 +527,7 @@ the config file by adding ``from yourapplication.default_settings import *`` to the top of the file and then overriding the changes by hand. You could also inspect an environment variable like ``YOURAPPLICATION_MODE`` and set that to `production`, `development` etc -and import different hardcoded files based on that. +and import different hard-coded files based on that. An interesting pattern is also to use classes and inheritance for configuration:: diff --git a/docs/design.rst b/docs/design.rst index f0f7126d..3dd1a284 100644 --- a/docs/design.rst +++ b/docs/design.rst @@ -41,7 +41,7 @@ the time. There are ways to fake multiple applications with a single application object, like maintaining a stack of applications, but this causes some problems I won't outline here in detail. Now the question is: when does a microframework need more than one application at the same -time? A good example for this is unittesting. When you want to test +time? A good example for this is unit testing. When you want to test something it can be very helpful to create a minimal application to test specific behavior. When the application object is deleted everything it allocated will be freed again. @@ -76,7 +76,7 @@ there are better ways to do that so that you do not lose the reference to the application object :meth:`~flask.Flask.wsgi_app`). Furthermore this design makes it possible to use a factory function to -create the application which is very helpful for unittesting and similar +create the application which is very helpful for unit testing and similar things (:ref:`app-factories`). The Routing System diff --git a/docs/extensiondev.rst b/docs/extensiondev.rst index aa4eff76..57d7425b 100644 --- a/docs/extensiondev.rst +++ b/docs/extensiondev.rst @@ -287,7 +287,7 @@ also avoids having multiple developers working in isolation on pretty much the same problem. Remember: good API design is hard, so introduce your project on the -mailinglist, and let other developers give you a helping hand with +mailing list, and let other developers give you a helping hand with designing the API. The best Flask extensions are extensions that share common idioms for the diff --git a/docs/extensions.rst b/docs/extensions.rst index 92e8a5b2..ecb587f9 100644 --- a/docs/extensions.rst +++ b/docs/extensions.rst @@ -6,7 +6,7 @@ Extensions Extensions are extra packages that add functionality to a Flask application. For example, an extension might add support for sending email or connecting to a database. Some extensions add entire new -frameworks to help build certain types of applications, like a ReST API. +frameworks to help build certain types of applications, like a REST API. Finding Extensions diff --git a/docs/shell.rst b/docs/shell.rst index 9d9bb5f9..c863a77d 100644 --- a/docs/shell.rst +++ b/docs/shell.rst @@ -20,7 +20,7 @@ can you do? This is where some helper functions come in handy. Keep in mind however that these functions are not only there for interactive shell usage, but -also for unittesting and other situations that require a faked request +also for unit testing and other situations that require a faked request context. Generally it's recommended that you read the :ref:`request-context` diff --git a/docs/unicode.rst b/docs/unicode.rst index 5aa6e25d..3ea10a07 100644 --- a/docs/unicode.rst +++ b/docs/unicode.rst @@ -43,8 +43,8 @@ The Golden Rule So the rule of thumb: if you are not dealing with binary data, work with Unicode. What does working with Unicode in Python 2.x mean? -- as long as you are using ASCII charpoints only (basically numbers, - some special characters of latin letters without umlauts or anything +- as long as you are using ASCII code points only (basically numbers, + some special characters of Latin letters without umlauts or anything fancy) you can use regular string literals (``'Hello World'``). - if you need anything else than ASCII in a string you have to mark this string as Unicode string by prefixing it with a lowercase `u`.