예제 #1
0
def use(backend):
    """Use the given database backend, e.g. 'MySQLdb', 'psycopg2',
    'MySQLdb', etc.
    """
    global Backend

    try:
        Backend = importlib.import_module(backend)
    except ImportError:
        msg = 'Could not import (load) database.backend: %s' % backend
        raise cfg.AitConfigError(msg)
예제 #2
0
 def __init__(self):
     try:
         self._backend = importlib.import_module(self._backend)
     except ImportError:
         msg = 'Could not import (load) database.backend: %s' % self._backend
         raise cfg.AitConfigError(msg)