diff options
author | Marcel Hellkamp <marc@gsites.de> | 2012-10-27 23:04:37 +0200 |
---|---|---|
committer | Marcel Hellkamp <marc@gsites.de> | 2012-10-28 00:11:15 +0200 |
commit | 9cd6fe3a27dca7dfe0dff0aed1499b7739f962ba (patch) | |
tree | 0dcd62c601f31afa3dcfece78222e1806268f9f6 /docs/tutorial_app.rst | |
parent | 08117068cc22b540241c2ca330382d77e4910223 (diff) | |
parent | 26ac343788ac4dd2bbdcf8d6734411a495571b17 (diff) | |
download | bottle-context.tar.gz |
Merge branch 'master' into context-mergecontext
Conflicts:
bottle.py
test/test_environ.py
test/test_sendfile.py
Diffstat (limited to 'docs/tutorial_app.rst')
-rw-r--r-- | docs/tutorial_app.rst | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/docs/tutorial_app.rst b/docs/tutorial_app.rst index 0a0201d..0b41ee0 100644 --- a/docs/tutorial_app.rst +++ b/docs/tutorial_app.rst @@ -250,21 +250,21 @@ The code needs to be extended to:: @route('/new', method='GET') def new_item(): - if request.GET.get('save','').strip(): + if request.GET.get('save','').strip(): - new = request.GET.get('task', '').strip() - conn = sqlite3.connect('todo.db') - c = conn.cursor() + new = request.GET.get('task', '').strip() + conn = sqlite3.connect('todo.db') + c = conn.cursor() - c.execute("INSERT INTO todo (task,status) VALUES (?,?)", (new,1)) - new_id = c.lastrowid + c.execute("INSERT INTO todo (task,status) VALUES (?,?)", (new,1)) + new_id = c.lastrowid - conn.commit() - c.close() + conn.commit() + c.close() - return '<p>The new task was inserted into the database, the ID is %s</p>' % new_id - else: - return template('new_task.tpl') + return '<p>The new task was inserted into the database, the ID is %s</p>' % new_id + else: + return template('new_task.tpl') ``new_task.tpl`` looks like this:: |