Setting('logger_hooke', 'qualname', 'hooke'),
Setting('handler_hand1', help='Configure the default log handler, see\nhttp://docs.python.org/library/logging.html#configuration-file-format', wrap=False),
Setting('handler_hand1', 'class', 'StreamHandler'),
- Setting('handler_hand1', 'level', 'NOTSET'),
+ Setting('handler_hand1', 'level', 'WARN'),
Setting('handler_hand1', 'formatter', 'form1'),
Setting('handler_hand1', 'args', '(sys.stderr,)'),
Setting('formatter_form1', help='Configure the default log formatter, see\nhttp://docs.python.org/library/logging.html#configuration-file-format', wrap=False),
>>> c = HookeConfigParser(default_settings=DEFAULT_SETTINGS)
>>> c.write(sys.stdout) # doctest: +ELLIPSIS
# Default environmental conditions in case they are not specified in
- # the force curve data.
+ # the force curve data. Configuration options in this section are
+ # available to every plugin.
[conditions]
# Temperature in Kelvin
temperature = 301
... Setting(section, option='my float', value=3.14159, type='float'),
... ])
>>> pprint.pprint(c.items(section)) # doctest: +ELLIPSIS
- [('my string', 'Lorem ipsum'),
+ [('my string', u'Lorem ipsum'),
('my bool', True),
('my int', 13),
('my float', 3.1415...)]
to use the standard `.get*()` methods.
>>> c.get('test conversion', 'my bool')
- 'True'
+ u'True'
>>> c.getboolean('test conversion', 'my bool')
True
"""
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