From afd3c4532b8625729bed9ed37a3eddd0b7b3b5a9 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Sat, 9 Nov 2013 13:41:09 +0000 Subject: [PATCH] Rewrapped lines --- docs/tutorial/dbinit.rst | 4 +++- docs/tutorial/schema.rst | 6 ++++-- docs/tutorial/setup.rst | 22 +++++++++++++--------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/docs/tutorial/dbinit.rst b/docs/tutorial/dbinit.rst index 418fe638..10c77a27 100644 --- a/docs/tutorial/dbinit.rst +++ b/docs/tutorial/dbinit.rst @@ -15,7 +15,9 @@ Such a schema can be created by piping the `schema.sql` file into the sqlite3 /tmp/flaskr.db < schema.sql The downside of this is that it requires the sqlite3 command to be -installed which is not necessarily the case on every system. This also require that we provide the path to the database which can introduce errors. It's a good idea to add a function that initializes the database +installed which is not necessarily the case on every system. This also +require that we provide the path to the database which can introduce +errors. It's a good idea to add a function that initializes the database for you to the application. To do this we can create a function called `init_db` that initializes the diff --git a/docs/tutorial/schema.rst b/docs/tutorial/schema.rst index 93b431aa..f8455037 100644 --- a/docs/tutorial/schema.rst +++ b/docs/tutorial/schema.rst @@ -3,8 +3,10 @@ Step 1: Database Schema ======================= -First we want to create the database schema. Only a single table is needed -for this application and we only want to support SQLite so creating the database schema is quite easy. Just put the following contents into a file named `schema.sql` in the just created `flaskr` folder: +First we want to create the database schema. Only a single table is needed +for this application and we only want to support SQLite so creating the +database schema is quite easy. Just put the following contents into a file +named `schema.sql` in the just created `flaskr` folder: .. sourcecode:: sql diff --git a/docs/tutorial/setup.rst b/docs/tutorial/setup.rst index ff3b92a8..acf227f9 100644 --- a/docs/tutorial/setup.rst +++ b/docs/tutorial/setup.rst @@ -4,11 +4,12 @@ Step 2: Application Setup Code ============================== Now that we have the schema in place we can create the application module. -Let's call it flaskr.py. We will place this file inside the flask folder. -We will begin by adding the imports we need and by adding the config section. -For small applications, it is possible to drop the configuration directly into -the module, and this is what we will be doing here. However a cleaner solution would be to create a separate `.ini` or `.py` file and load that or import the -values from there. +Let's call it flaskr.py. We will place this file inside the flask folder. +We will begin by adding the imports we need and by adding the config +section. For small applications, it is possible to drop the configuration +directly into the module, and this is what we will be doing here. However +a cleaner solution would be to create a separate `.ini` or `.py` file and +load that or import the values from there. First we add the imports in `flaskr.py`:: @@ -65,10 +66,13 @@ debug flag enables or disables the interactive debugger. *Never leave debug mode activated in a production system*, because it will allow users to execute code on the server! -We will also add a method that allows for easily connecting to the specified database. This can be used to open a connection on request and also from the interactive Python shell or a script. This will come in handy later. We create a -simple database connection through SQLite and then tell it to use the -:class:`sqlite3.Row` object to represent rows. This allows us to treat -the rows as if they were dictionaries instead of tuples. +We will also add a method that allows for easily connecting to the +specified database. This can be used to open a connection on request and +also from the interactive Python shell or a script. This will come in +handy later. We create a simple database connection through SQLite and +then tell it to use the :class:`sqlite3.Row` object to represent rows. +This allows us to treat the rows as if they were dictionaries instead of +tuples. ::