def is_connection_usable(func):
def wrapper(*args, **kwargs):
result = None
try:
result = func(*args, **kwargs)
result[0]
except OperationalError:
connection.close()
result = func(*args, **kwargs)
return result
return wrapper
def is_connection_usable(func):
def wrapper(*args, **kwargs):
result = None
try:
result = func(*args, **kwargs)
result[0]
except OperationalError:
connection.close()
result = func(*args, **kwargs)
return result
return wrapper