Skip to content
Myr

Merge pull request #3199 from alecbrooks/master

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix various small spelling errors.

authored by David Lord · committed by GitHub · parents 7f782ba, 4e272fc · Browse files · 9 files+14 added−14 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

9 files+14 added−14 removed

  • other:+14 added−14 removed

9 files+14 added−14 removed

modified:docs/appcontext.rst+1 added-1 removed
47 unmodified lines
48Typically, an application context will have the same lifetime as a49request.5051See :doc:`/reqcontext` for more information about how the contexts work52and the full lifecycle of a request.52and the full life cycle of a request.535455Manually Push a Context56-----------------------
103 unmodified lines
modified:docs/becomingbig.rst+1 added-1 removed
94 unmodified lines
95---------------------------9697The Flask developers keep the framework accessible to users with codebases big98and small. If you find an obstacle in your way, caused by Flask, don't hesitate99to contact the developers on the mailinglist or IRC channel. The best way for99to contact the developers on the mailing list or IRC channel. The best way for100the Flask and Flask extension developers to improve the tools for larger101applications is getting feedback from users.
modified:docs/blueprints.rst+2 added-2 removed
242 unmodified lines
243244Error Handlers245--------------246247Blueprints support the errorhandler decorator just like the :class:`Flask`247Blueprints support the ``errorhandler`` decorator just like the :class:`Flask`248application object, so it is easy to make Blueprint-specific custom error249pages.250251Here is an example for a "404 Page Not Found" exception::
6 unmodified lines
258concerning handlers for 404 and 405 exceptions. These errorhandlers are only259invoked from an appropriate ``raise`` statement or a call to ``abort`` in another260of the blueprint's view functions; they are not invoked by, e.g., an invalid URL261access. This is because the blueprint does not "own" a certain URL space, so262the application instance has no way of knowing which blueprint errorhandler it262the application instance has no way of knowing which blueprint error handler it263should run if given an invalid URL. If you would like to execute different264handling strategies for these errors based on URL prefixes, they may be defined265at the application level using the ``request`` proxy object::266
9 unmodified lines
modified:docs/config.rst+3 added-3 removed
7 unmodified lines
8toggling the debug mode, setting the secret key, and other such9environment-specific things.1011The way Flask is designed usually requires the configuration to be12available when the application starts up. You can hardcode the12available when the application starts up. You can hard code the13configuration in the code, which for many small applications is not14actually that bad, but there are better ways.1516Independent of how you load your config, there is a config object
476 unmodified lines
493that experience:4944951. Create your application in a function and register blueprints on it.496 That way you can create multiple instances of your application with497 different configurations attached which makes unittesting a lot497 different configurations attached which makes unit testing a lot498 easier. You can use this to pass in configuration as needed.4995002. Do not write code that needs the configuration at import time. If you501 limit yourself to request-only accesses to the configuration you can
24 unmodified lines
526the config file by adding ``from yourapplication.default_settings527import *`` to the top of the file and then overriding the changes by hand.528You could also inspect an environment variable like529``YOURAPPLICATION_MODE`` and set that to `production`, `development` etc530and import different hardcoded files based on that.530and import different hard-coded files based on that.531532An interesting pattern is also to use classes and inheritance for533configuration::534
160 unmodified lines
modified:docs/design.rst+2 added-2 removed
39 unmodified lines
40the time. There are ways to fake multiple applications with a single41application object, like maintaining a stack of applications, but this42causes some problems I won't outline here in detail. Now the question is:43when does a microframework need more than one application at the same44time? A good example for this is unittesting. When you want to test44time? A good example for this is unit testing. When you want to test45something it can be very helpful to create a minimal application to test46specific behavior. When the application object is deleted everything it47allocated will be freed again.48
26 unmodified lines
75there are better ways to do that so that you do not lose the reference76to the application object :meth:`~flask.Flask.wsgi_app`).7778Furthermore this design makes it possible to use a factory function to79create the application which is very helpful for unittesting and similar79create the application which is very helpful for unit testing and similar80things (:ref:`app-factories`).8182The Routing System83------------------
108 unmodified lines
modified:docs/extensiondev.rst+1 added-1 removed
285 unmodified lines
286also avoids having multiple developers working in isolation on pretty much the287same problem.288289Remember: good API design is hard, so introduce your project on the290mailinglist, and let other developers give you a helping hand with290mailing list, and let other developers give you a helping hand with291designing the API.292293The best Flask extensions are extensions that share common idioms for the294API. And this can only work if collaboration happens early.
51 unmodified lines
modified:docs/extensions.rst+1 added-1 removed
4 unmodified lines
56Extensions are extra packages that add functionality to a Flask7application. For example, an extension might add support for sending8email or connecting to a database. Some extensions add entire new9frameworks to help build certain types of applications, like a ReST API.9frameworks to help build certain types of applications, like a REST API.101112Finding Extensions13------------------
40 unmodified lines
modified:docs/shell.rst+1 added-1 removed
18 unmodified lines
19can you do?2021This is where some helper functions come in handy. Keep in mind however22that these functions are not only there for interactive shell usage, but23also for unittesting and other situations that require a faked request23also for unit testing and other situations that require a faked request24context.2526Generally it's recommended that you read the :ref:`request-context`27chapter of the documentation first.
76 unmodified lines
modified:docs/unicode.rst+2 added-2 removed
41 unmodified lines
4243So the rule of thumb: if you are not dealing with binary data, work with44Unicode. What does working with Unicode in Python 2.x mean?4546- as long as you are using ASCII charpoints only (basically numbers,47 some special characters of latin letters without umlauts or anything46- as long as you are using ASCII code points only (basically numbers,47 some special characters of Latin letters without umlauts or anything48 fancy) you can use regular string literals (``'Hello World'``).49- if you need anything else than ASCII in a string you have to mark50 this string as Unicode string by prefixing it with a lowercase `u`.51 (like ``u'Hänsel und Gretel'``)
56 unmodified lines