def cursor(self): if self._link and self._link.get_transaction_status() == 3: logging.warning("db: Transaction is corrupted") logging.info("db: Running rollback command") self._link.rollback() if not self._cursor: logging.info("db: Initializing new database cursor.") self._cursor = self.link.cursor() return self._cursor
# Project Settings DEBUG = True WORKING_DIR = os.path.dirname(__file__) DB_DRIVER = None DB_USER = '******' DB_PASSWORD = "******" DB_NAME = "dasornis" DB_HOST = "localhost" LOG_FILE = 'dasornislog' TEMPLATE_ENGINE = '' TEMPLATE_DIRS = ( # Template directories comes here ) ENABLE_I18N = True I18N_PACKAGE = None DEFAULT_LANG = None ''' Importing project configuration file if exists ''' import os config_module = os.environ.get('DASORNIS_CONFIG_MODULE') or 'dasornisconf' try: exec "from %s import *"%config_module except ImportError: from dasornis.log import logging logging.warning("Could not import configuration module '%s'."%config_module)