diff options
author | Rob Austein <sra@hactrn.net> | 2008-03-28 22:06:14 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2008-03-28 22:06:14 +0000 |
commit | d59d3e4dc2fea94c3fde72614deddbff8b386484 (patch) | |
tree | 1dce720eb76b07af5f813c405c97eab6bc58452e /rpkid/rpki/sql.py | |
parent | 5aa99a66a4cd1064eda1880879e034b7ae8058ac (diff) |
Switch to using OpenSSL HEAD snapshot, for the new CMS code
svn path=/openssl/Makefile; revision=1566
Diffstat (limited to 'rpkid/rpki/sql.py')
-rw-r--r-- | rpkid/rpki/sql.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/rpkid/rpki/sql.py b/rpkid/rpki/sql.py index 1244a80f..ddddbe9f 100644 --- a/rpkid/rpki/sql.py +++ b/rpkid/rpki/sql.py @@ -14,18 +14,17 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -import MySQLdb, time +import MySQLdb, time, warnings, _mysql_exceptions import rpki.x509, rpki.resource_set, rpki.sundial -# Turn all MySQL warnings into exceptions, at least for now -# -import warnings, _mysql_exceptions -warnings.simplefilter("error", _mysql_exceptions.Warning) - -def connect(cfg): +def connect(cfg, throw_exception_on_warning = True): """Connect to a MySQL database using connection parameters from an rpki.config.parser object. """ + + if throw_exception_on_warning: + warnings.simplefilter("error", _mysql_exceptions.Warning) + return MySQLdb.connect(user = cfg.get("sql-username"), db = cfg.get("sql-database"), passwd = cfg.get("sql-password")) |