RPKI Engine  1.0
mysql_import.py (3946)
Go to the documentation of this file.
00001 """
00002 Import wrapper for MySQLdb.
00003 
00004 MySQLdb is an independent package, not part of Python, and has some
00005 minor version skew issues with respect to Python itself, which we want
00006 to suppress so that they don't annoy the user.  None of this is
00007 particularly hard, but the maze of whacky incantations required to do
00008 this in multiple version of Python on multiple platforms is somewhat
00009 tedious, and turns out to cause other problems when combined with the
00010 way we construct executable Python scripts containing a standard
00011 header indicating the location of our config file.
00012 
00013 So it turns out to be easier just to put all of the import voodoo
00014 here, and have other modules that need MySQLdb import the MySQL module
00015 object from this module.  Looks kind of strange, but seems to work.
00016 
00017 $Id: mysql_import.py 3946 2011-07-27 18:21:45Z sra $
00018 
00019 Copyright (C) 2011  Internet Systems Consortium ("ISC")
00020 
00021 Permission to use, copy, modify, and distribute this software for any
00022 purpose with or without fee is hereby granted, provided that the above
00023 copyright notice and this permission notice appear in all copies.
00024 
00025 THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00026 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00027 AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00028 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00029 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00030 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00031 PERFORMANCE OF THIS SOFTWARE.
00032 
00033 Portions copyright (C) 2007--2008  American Registry for Internet Numbers ("ARIN")
00034 
00035 Permission to use, copy, modify, and distribute this software for any
00036 purpose with or without fee is hereby granted, provided that the above
00037 copyright notice and this permission notice appear in all copies.
00038 
00039 THE SOFTWARE IS PROVIDED "AS IS" AND ARIN DISCLAIMS ALL WARRANTIES WITH
00040 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00041 AND FITNESS.  IN NO EVENT SHALL ARIN BE LIABLE FOR ANY SPECIAL, DIRECT,
00042 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00043 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00044 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00045 PERFORMANCE OF THIS SOFTWARE.
00046 """
00047 
00048 from __future__ import with_statement
00049 
00050 import warnings
00051 
00052 if hasattr(warnings, "catch_warnings"):
00053   with warnings.catch_warnings():
00054     warnings.simplefilter("ignore", DeprecationWarning)
00055     import MySQLdb
00056 else:
00057   import MySQLdb
00058 
00059 import _mysql_exceptions
00060 
00061 warnings.simplefilter("error", _mysql_exceptions.Warning)
 All Classes Namespaces Files Functions Variables Properties