From 3243cdfbe9bd7d7b96aa164ec58ee3bf8342eb17 Mon Sep 17 00:00:00 2001 From: Chuck Short Date: Fri, 12 Jul 2013 15:48:57 -0400 Subject: python3: handle module moves in log Python 3 reorganized the standard library and moved several functions to different modules. Six provides a consistent interface to them through the fake six.moves module. Change-Id: I040fe8e0e4640e7cdd805ab49891b94da6cc4595 Signed-off-by: Chuck Short --- openstack/common/log.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'openstack') diff --git a/openstack/common/log.py b/openstack/common/log.py index 465886b..c7e729c 100644 --- a/openstack/common/log.py +++ b/openstack/common/log.py @@ -29,8 +29,6 @@ It also allows setting of formatting information through conf. """ -import ConfigParser -import cStringIO import inspect import itertools import logging @@ -41,6 +39,7 @@ import sys import traceback from oslo.config import cfg +from six import moves from openstack.common.gettextutils import _ # noqa from openstack.common import importutils @@ -348,7 +347,7 @@ class LogConfigError(Exception): def _load_log_config(log_config): try: logging.config.fileConfig(log_config) - except ConfigParser.Error as exc: + except moves.configparser.Error as exc: raise LogConfigError(log_config, str(exc)) @@ -521,7 +520,7 @@ class ContextFormatter(logging.Formatter): if not record: return logging.Formatter.formatException(self, exc_info) - stringbuffer = cStringIO.StringIO() + stringbuffer = moves.StringIO() traceback.print_exception(exc_info[0], exc_info[1], exc_info[2], None, stringbuffer) lines = stringbuffer.getvalue().split('\n') -- cgit