From 062aa0b798ce06e40c04604c329e991568fcaec0 Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Sat, 24 Sep 2011 11:29:55 +0100 Subject: [PATCH] do not log since logging is not setup yet anyway; unquote configuration values --- client/djrandom_client/utils.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/client/djrandom_client/utils.py b/client/djrandom_client/utils.py index a1241ee..5efa285 100644 --- a/client/djrandom_client/utils.py +++ b/client/djrandom_client/utils.py @@ -1,11 +1,8 @@ import hashlib -import logging import os NESTING = 2 -log = logging.getLogger(__name__) - def generate_path(base_dir, sha1): dir_parts = [base_dir] @@ -31,8 +28,14 @@ class SyntaxError(Exception): pass +def _unquote(s): + for qchar in ('"', '\''): + if s.startswith(qchar) and s.endswith(qchar): + return s.strip(qchar) + return s + + def read_config_defaults(parser, path): - log.debug('reading config from %s' % path) if not os.path.exists(path): return with open(path, 'r') as fd: @@ -44,5 +47,4 @@ def read_config_defaults(parser, path): raise SyntaxError('%s, line %d: Syntax Error' % ( path, 1 + linenum)) var, value = map(lambda x: x.strip(), line.split('=', 1)) - log.debug('config: %s = "%s"' % (var, value)) - parser.set_default(var, value) + parser.set_default(var, _unquote(value)) -- GitLab