Commit 609bc6b9 authored by André Anjos's avatar André Anjos 💬
Browse files

Release SQLite file connection when Database object is deleted

parent 083f2687
......@@ -28,6 +28,10 @@ class Database(object):
# opens a session to the database - keep it open until the end
def __del__(self):
"""Releases the opened file descriptor"""
if self.session: self.session.bind.dispose()
def connect(self):
"""Tries connecting or re-connecting to the database"""
if not os.path.exists(SQLITE_FILE):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment