mirror of
https://github.com/kennethreitz/records.git
synced 2026-06-05 23:00:20 +00:00
manual db close
This commit is contained in:
+7
-1
@@ -209,12 +209,18 @@ class Database(object):
|
||||
|
||||
# Enable hstore if it's available.
|
||||
self._enable_hstore()
|
||||
self.open = True
|
||||
|
||||
# Closes the connection manually
|
||||
def close(self):
|
||||
self.db.close()
|
||||
self.open = False
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, exc, val, traceback):
|
||||
self.db.close()
|
||||
self.close()
|
||||
|
||||
def _enable_hstore(self):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user