From: Joar Wandborg Date: Sun, 30 Sep 2012 12:42:12 +0000 (+0200) Subject: Use RawConfigParser instead of dict.viewitems X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b4ab702f10aaeefe2cf8f3559aa007188ee31472;p=mediagoblin.git Use RawConfigParser instead of dict.viewitems dict.viewitems breaks python 2.6 compatibility. --- diff --git a/mediagoblin/init/celery/from_celery.py b/mediagoblin/init/celery/from_celery.py index 01da6b32..fc6b1e37 100644 --- a/mediagoblin/init/celery/from_celery.py +++ b/mediagoblin/init/celery/from_celery.py @@ -18,6 +18,7 @@ import os import logging from configobj import ConfigObj +from ConfigParser import RawConfigParser from celery.signals import setup_logging from mediagoblin import app, mg_globals @@ -32,7 +33,7 @@ _log.setLevel(logging.DEBUG) _log.warning('Test') -def setup_logging_from_paste_ini(*args, **kw): +def setup_logging_from_paste_ini(loglevel, **kw): if os.path.exists(os.path.abspath('paste_local.ini')): logging_conf_file = 'paste_local.ini' else: @@ -46,10 +47,13 @@ def setup_logging_from_paste_ini(*args, **kw): config = logging_conf + # Read raw config to avoid interpolation of formatting parameters + raw_config = RawConfigParser() + raw_config.readfp(open(logging_conf_file)) + # Set up formatting # Get the format string and circumvent configobj interpolation of the value - fmt = config['formatter_generic'].viewitems().__iter__()\ - .next()[1] + fmt = raw_config.get('formatter_generic', 'format') # Create the formatter formatter = logging.Formatter(fmt)