Skip to content
Myr

Merge pull request #817 from llimllib/master

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

Fix doc bug in patterns/sqlite3, clarify use of make_dicts

authored by Armin Ronacher · committed by Armin Ronacher · parents 2e17ad7, 159ae3d · Browse files · 1 file+2 added−2 removed
This commit

State

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

Diff stats

1 file+2 added−2 removed

  • other:+2 added−2 removed

1 file+2 added−2 removed

modified:docs/patterns/sqlite3.rst+2 added-2 removed
70 unmodified lines
71Now in each request handling function you can access `g.db` to get the72current open database connection. To simplify working with SQLite, a73row factory function is useful. It is executed for every result returned74from the database to convert the result. For instance in order to get75dictionaries instead of tuples this can be used::75dictionaries instead of tuples this could be inserted into ``get_db``::7677 def make_dicts(cursor, row):78 return dict((cur.description[idx][0], value)78 return dict((cursor.description[idx][0], value)79 for idx, value in enumerate(row))8081 db.row_factory = make_dicts82
56 unmodified lines