Permalink
Browse files

Explicitly define and use the connection context manager.

  • Loading branch information...
1 parent bd02281 commit 69b5bf85e4abec64c8ec3cb8f74691aad9dee312 Apostolos Bessas committed Apr 7, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 receipts/db.py
View
@@ -41,5 +41,5 @@ def _reset_filename(self):
def insert_receipt(receipt):
"""Insert a receipt to the database."""
- with conn():
- conn.execute(INSERT_RECEIPT, receipt._db_values())
+ with conn() as con:
+ con.execute(INSERT_RECEIPT, receipt._db_values())

0 comments on commit 69b5bf8

Please sign in to comment.