From 4a739a155b00e582435d7906840f58282ebf8f7d Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Wed, 27 Jul 2011 18:21:45 +0000 Subject: Consolidate all of the import voodoo for MySQLdb into a new module. svn path=/buildtools/make-python-executable.py; revision=3946 --- rpkid/rpki/sql.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'rpkid/rpki/sql.py') diff --git a/rpkid/rpki/sql.py b/rpkid/rpki/sql.py index b7acf562..b6be65b6 100644 --- a/rpkid/rpki/sql.py +++ b/rpkid/rpki/sql.py @@ -32,19 +32,8 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """ -from __future__ import with_statement +from rpki.mysql_import import (MySQLdb, _mysql_exceptions) -import warnings - -# Silence warning while loading MySQLdb in Python 2.6, sigh -if hasattr(warnings, "catch_warnings"): - with warnings.catch_warnings(): - warnings.simplefilter("ignore", DeprecationWarning) - import MySQLdb -else: - import MySQLdb - -import _mysql_exceptions import rpki.x509, rpki.resource_set, rpki.sundial, rpki.log class session(object): @@ -52,14 +41,8 @@ class session(object): SQL session layer. """ - _exceptions_enabled = False - def __init__(self, cfg): - if not self._exceptions_enabled: - warnings.simplefilter("error", _mysql_exceptions.Warning) - self.__class__._exceptions_enabled = True - self.username = cfg.get("sql-username") self.database = cfg.get("sql-database") self.password = cfg.get("sql-password") -- cgit v1.2.3