Skip to content
Myr

Fix some typos in the docs

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

authored by jgraeme · committed by Armin Ronacher · parent 41f5ad9 · Browse files · 4 files+9 added−9 removed
This commit

State

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

Trailers

  • Signed-off-by: Armin Ronacher <armin.ronacher@active-4.com>

Diff stats

4 files+9 added−9 removed

  • other:+9 added−9 removed

4 files+9 added−9 removed

modified:docs/patterns/appfactories.rst+1 added-1 removed
2 unmodified lines
3Application Factories4=====================56If you are already using packages and modules for your application7(:ref:`packages`) there are couple of really nice ways to further improve7(:ref:`packages`) there are a couple of really nice ways to further improve8the experience. A common pattern is creating the application object when9the module is imported. But if you move the creation of this object,10into a function, you can then create multiple instances of this and later.11
64 unmodified lines
modified:docs/patterns/index.rst+2 added-2 removed
1 unmodified line
23Patterns for Flask4==================56Certain things are common enough that the changes are high you will find6Certain things are common enough that the chances are high you will find7them in most web applications. For example quite a lot of applications8are using relational databases and user authentication. In that case,9changes are they will open a database connection at the beginning of the9chances are they will open a database connection at the beginning of the10request and get the information of the currently logged in user. At the11end of the request, the database connection is closed again.1213There are more user contributed snippets and patterns in the `Flask
19 unmodified lines
modified:docs/patterns/packages.rst+5 added-5 removed
57 unmodified lines
58 decorator on top) have to be imported when in the `__init__.py` file.59 Not the object itself, but the module it is in. Do the importing at60 the *bottom* of the file.6162Here an example `__init__.py`::62Here's an example `__init__.py`::6364 from flask import Flask65 app = Flask(__name__)66
41 unmodified lines
108Working with Modules109--------------------110111For larger applications with more than a dozen views it makes sense to112split the views into modules. First let's look at the typical struture of112split the views into modules. First let's look at the typical structure of113such an application::114115 /yourapplication116 /yourapplication
15 unmodified lines
132`admin.py` file in the view package.133134First we have to create a :class:`~flask.Module` object with the name of135the package. This works very similar to the :class:`~flask.Flask` object136you have already worked with, it just does not support all of the method,136you have already worked with, it just does not support all of the methods,137but most of them are the same.138139Long story short, here a nice and concise example::139Long story short, here's a nice and concise example::140141 from flask import Module142143 admin = Module(__name__)
6 unmodified lines
150 def login():151 pass152153 @admin.route('/logout')154 def login():154 def logout():155 pass156157Do the same with the `frontend.py` and then make sure to register the158modules in the application (`__init__.py`) like this::
41 unmodified lines
modified:docs/extensiondev.rst+1 added-1 removed
158 unmodified lines
159160classes:161 Classes work mostly like initialization functions but can later be162 used to further change the behaviour. For an example look at how the163 `OAuth extension`_ works: ther is an `OAuth` object that provides163 `OAuth extension`_ works: there is an `OAuth` object that provides164 some helper functions like `OAuth.remote_app` to create a reference to165 a remote application that uses OAuth.166167What to use depends on what you have in mind. For the SQLite 3 extension
109 unmodified lines