Commits

Jason R. Coombs committed 10978ad

Load configparser module from py27compat

  • Participants
  • Parent commits 80bbb12

Comments (0)

Files changed (1)

File keyring/core.py

 Created by Kang Zhang on 2009-07-09
 """
 import os
-try:
-    import configparser as config_parser
-except ImportError:
-    import ConfigParser as config_parser
 import imp
 import sys
 
+from .py27compat import configparser
+
 from keyring import logger
 from keyring import backend
 from keyring.util import platform
             break
 
     if os.path.exists(keyring_cfg):
-        config = config_parser.RawConfigParser()
+        config = configparser.RawConfigParser()
         config.read(keyring_cfg)
         # load the keyring-path option
         try:
                 keyring_path = config.get("backend", "keyring-path").strip()
             else:
                 keyring_path = None
-        except config_parser.NoOptionError:
+        except configparser.NoOptionError:
             keyring_path = None
 
         # load the keyring class name, and then load this keyring
             if config.has_section("backend"):
                 keyring_name = config.get("backend", "default-keyring").strip()
             else:
-                raise config_parser.NoOptionError('backend', 'default-keyring')
+                raise configparser.NoOptionError('backend', 'default-keyring')
 
             keyring = load_keyring(keyring_path, keyring_name)
-        except (config_parser.NoOptionError, ImportError):
+        except (configparser.NoOptionError, ImportError):
             logger.warning("Keyring config file contains incorrect values.\n" +
                            "Config file: %s" % keyring_cfg)