From: W. Trevor King Date: Tue, 10 Aug 2010 19:23:10 +0000 (-0400) Subject: Log warning for invalid section/option settings X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d0af162936b5ad854f96ea3db0e3c3697c1ecc0a;p=hooke.git Log warning for invalid section/option settings --- diff --git a/hooke/config.py b/hooke/config.py index 0135f6b..ea5b2e4 100644 --- a/hooke/config.py +++ b/hooke/config.py @@ -300,12 +300,16 @@ class HookeConfigParser (configparser.RawConfigParser): self, section, *args, **kwargs) for i,kv in enumerate(items): key,value = kv - setting = self._default_settings_dict[(section, key)] + log = logging.getLogger('hooke') + try: + setting = self._default_settings_dict[(section, key)] + except KeyError, e: + log.error('unknown setting %s/%s: %s' % (section, key, e)) + raise try: items[i] = (key, from_string(value=value, type=setting.type, count=setting.count)) except ValueError, e: - log = logging.getLogger('hooke') log.error("could not convert '%s' (%s) for %s/%s: %s" % (value, type(value), section, key, e)) raise