Commit 34adea84 authored by Stewart Martin-Haugh's avatar Stewart Martin-Haugh
Browse files

Remove custom ImportError code

parent 53a08bf1
...@@ -260,8 +260,7 @@ def getTriggerDBCursor(connection): ...@@ -260,8 +260,7 @@ def getTriggerDBCursor(connection):
return cursor,schema return cursor,schema
def _get_sqlite_cursor (filename): def _get_sqlite_cursor (filename):
try: import sqlite3 import sqlite3
except ImportError: raise RuntimeError, "ERROR: Can't import sqlite3?"
os.lstat(filename) os.lstat(filename)
connection = sqlite3.connect(filename) connection = sqlite3.connect(filename)
return connection.cursor() return connection.cursor()
...@@ -271,8 +270,7 @@ def _get_oracle_cursor (tns, user, passwd=""): ...@@ -271,8 +270,7 @@ def _get_oracle_cursor (tns, user, passwd=""):
from getpass import getpass from getpass import getpass
passwd = getpass("[Oracle] database password for %s@%s: " % (user, tns)) passwd = getpass("[Oracle] database password for %s@%s: " % (user, tns))
try: from cx_Oracle import connect from cx_Oracle import connect
except ImportError: raise RuntimeError, "ERROR: Can't import cx_Oracle?"
connection = connect (user, passwd, tns, threaded=True) connection = connect (user, passwd, tns, threaded=True)
return connection.cursor() return connection.cursor()
...@@ -282,8 +280,7 @@ def _get_mysql_cursor (host, db, user, passwd=""): ...@@ -282,8 +280,7 @@ def _get_mysql_cursor (host, db, user, passwd=""):
from getpass import getpass from getpass import getpass
passwd = getpass("[MySQL] `%s' database password for %s@%s: " % (db, user, host)) passwd = getpass("[MySQL] `%s' database password for %s@%s: " % (db, user, host))
try: from MySQLdb import connect from MySQLdb import connect
except ImportError: raise RuntimeError, "ERROR: Can't import MySQLdb?"
connection = connect(host=host, user=user, passwd=passwd, db=db, connect_timeout=10) connection = connect(host=host, user=user, passwd=passwd, db=db, connect_timeout=10)
return connection.cursor() return connection.cursor()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment