diff options
author | Rob Austein <sra@hactrn.net> | 2009-12-21 16:48:32 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2009-12-21 16:48:32 +0000 |
commit | cba5f61350bc202daeaace764f2c4366f8fcac53 (patch) | |
tree | 171b3414d99158703f4623ccb2586cc7b899a761 /rpkid | |
parent | 20830c643ce3bc378d8a42b03076fa2d430f563d (diff) |
Suppress Python 2.6 warnings about MySQLdb using deprecated sets
module, since the code still works and this is beyond our control.
svn path=/rpkid/irdbd.py; revision=2894
Diffstat (limited to 'rpkid')
-rw-r--r-- | rpkid/irdbd.py | 10 | ||||
-rw-r--r-- | rpkid/rpki/sql.py | 12 | ||||
-rw-r--r-- | rpkid/testbed.py | 10 |
3 files changed, 29 insertions, 3 deletions
diff --git a/rpkid/irdbd.py b/rpkid/irdbd.py index 459758df..9facc6aa 100644 --- a/rpkid/irdbd.py +++ b/rpkid/irdbd.py @@ -36,10 +36,18 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """ -import sys, os, time, getopt, urlparse, MySQLdb +import sys, os, time, getopt, urlparse, warnings import rpki.https, rpki.config, rpki.resource_set, rpki.relaxng import rpki.exceptions, rpki.left_right, rpki.log, rpki.x509 +# 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 + def handle_list_resources(q_pdu, r_msg): r_pdu = rpki.left_right.list_resources_elt() diff --git a/rpkid/rpki/sql.py b/rpkid/rpki/sql.py index e133ffd9..a3ab9e55 100644 --- a/rpkid/rpki/sql.py +++ b/rpkid/rpki/sql.py @@ -32,7 +32,17 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """ -import MySQLdb, warnings, _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): diff --git a/rpkid/testbed.py b/rpkid/testbed.py index 30cc0cb0..efcbaf5c 100644 --- a/rpkid/testbed.py +++ b/rpkid/testbed.py @@ -48,10 +48,18 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """ -import os, yaml, MySQLdb, subprocess, signal, time, getopt, sys +import os, yaml, warnings, subprocess, signal, time, getopt, sys import rpki.resource_set, rpki.sundial, rpki.x509, rpki.https import rpki.log, rpki.left_right, rpki.config, rpki.publication, rpki.async +# 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 + os.environ["TZ"] = "UTC" time.tzset() |