From d6c5309aa3db51fc5d9145195152c0c1accf8286 Mon Sep 17 00:00:00 2001 From: Eric Blade Date: Tue, 15 Sep 2009 20:10:18 -0500 Subject: [PATCH] clean up some module import code in fpdb_import --- pyfpdb/fpdb_import.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index 2e299c5f..4e5febcc 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -49,22 +49,20 @@ log = logging.getLogger('importer') # database interface modules try: import MySQLdb - mysqlLibFound=True - log.debug("Import module: MySQLdb") except: - log.debug("Import module: MySQLdb not found") - + log.debug("Import database module: MySQLdb not found") +else: + mysqlLibFound = True + try: import psycopg2 - pgsqlLibFound=True +except: + log.debug("Import database module: psycopg2 not found") +else: import psycopg2.extensions psycopg2.extensions.register_type(psycopg2.extensions.UNICODE) - log.debug("Import module: psycopg2") -except: - log.debug("Import module: psycopg2 not found") class Importer: - def __init__(self, caller, settings, config, sql = None): """Constructor""" self.settings = settings