Minor tutorial documentation fixes (grammar, etc)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Adam Zapletal · committed by Armin Ronacher · parent 87c2c79 · Browse files · 2 files·+16 added−16 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+16 added−16 removed
- other:+16 added−16 removed
Provenance
- Commit
5ede530- Tree
254fdce- Author
Adam Zapletal <adamzap@gmail.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
87c2c79
2 files changed+16 added−16 removed
modified:docs/tutorial/setup.rst+2 added-2 removed
50 unmodified lines51 The `secret_key` is needed to keep the client-side sessions secure.52 Choose that key wisely and as hard to guess and complex as possible. The53 debug flag enables or disables the interactive debugger. Never leave54 debug mode activated in a production system because it will allow users to55-executed code on the server!55+execute code on the server!56 57 We also add a method to easily connect to the database specified. That58 can be used to open a connection on request and also from the interactive59 Python shell or a script. This will come in handy later3 unmodified lines63 def connect_db():64 return sqlite3.connect(app.config['DATABASE'])65 66 Finally we just add a line to the bottom of the file that fires up the67-server if we run that file as standalone application::67+server if we want to run that file as a standalone application::68 69 if __name__ == '__main__':70 app.run()71 12 unmodified linesmodified:docs/tutorial/views.rst+14 added-14 removed
9 unmodified lines10 ------------11 12 This view shows all the entries stored in the database. It listens on the13 root of the application and will select title and text from the database.14-The one with the highest id (the newest entry) on top. The rows returned15-from the cursor are tuples with the columns ordered like specified in the16-select statement. This is good enough for small applications like here,17-but you might want to convert them into a dict. If you are interested how18-to do that, check out the :ref:`easy-querying` example.14+The one with the highest id (the newest entry) will be on top. The rows15+returned from the cursor are tuples with the columns ordered like specified16+in the select statement. This is good enough for small applications like17+here, but you might want to convert them into a dict. If you are18+interested in how to do that, check out the :ref:`easy-querying` example.19 20 The view function will pass the entries as dicts to the21 `show_entries.html` template and return the rendered one::22 29 unmodified lines52 ----------------53 54 These functions are used to sign the user in and out. Login checks the55 username and password against the ones from the configuration and sets the56-`logged_in` key in the session. If the user logged in successfully that57-key is set to `True` and the user is redirected back to the `show_entries`58-page. In that case also a message is flashed that informs the user he or59-she was logged in successfully. If an error occoured the template is60-notified about that and the user asked again::56+`logged_in` key in the session. If the user logged in successfully, that57+key is set to `True`, and the user is redirected back to the `show_entries`58+page. In addition, a message is flashed that informs the user that he or59+she was logged in successfully. If an error occurred, the template is60+notified about that, and the user is asked again::61 62 @app.route('/login', methods=['GET', 'POST'])63 def login():64 error = None7 unmodified lines72 flash('You were logged in')73 return redirect(url_for('show_entries'))74 return render_template('login.html', error=error)75 76-The logout function on the other hand removes that key from the session76+The logout function, on the other hand, removes that key from the session77 again. We use a neat trick here: if you use the :meth:`~dict.pop` method78-of the dict and pass a second parameter to it (the default) the method78+of the dict and pass a second parameter to it (the default), the method79 will delete the key from the dictionary if present or do nothing when that80-key was not in there. This is helpful because we don't have to check in81-that case if the user was logged in.80+key is not in there. This is helpful because now we don't have to check81+if the user was logged in.82 83 ::84 85 @app.route('/logout')6 unmodified lines