added is_installed function to legacy_io

This commit is contained in:
Jakub Trllo 2022-06-13 19:31:52 +02:00
parent b81dbf9ee4
commit 3aa88814a1

View file

@ -18,9 +18,13 @@ _database = database = None
log = logging.getLogger(__name__)
def is_installed():
return module._is_installed
def install():
"""Establish a persistent connection to the database"""
if module._is_installed:
if is_installed():
return
session = session_data_from_environment(context_keys=True)
@ -55,7 +59,7 @@ def uninstall():
def requires_install(func):
@functools.wraps(func)
def decorated(*args, **kwargs):
if not module._is_installed:
if not is_installed():
install()
return func(*args, **kwargs)
return decorated