Kaydet (Commit) 423c0d5e authored tarafından Aymeric Augustin's avatar Aymeric Augustin

Added a safety net for developers messing with autocommit.

üst 107d9b1d
......@@ -417,12 +417,19 @@ class BaseDatabaseWrapper(object):
or if it outlived its maximum age.
"""
if self.connection is not None:
# If the application didn't restore the original autocommit setting,
# don't take chances, drop the connection.
if self.autocommit != self.settings_dict['AUTOCOMMIT']:
self.close()
return
if self.errors_occurred:
if self.is_usable():
self.errors_occurred = False
else:
self.close()
return
if self.close_at is not None and time.time() >= self.close_at:
self.close()
return
......
Markdown is supported
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