summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2010-03-06 15:56:03 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2010-03-06 15:56:03 (GMT)
commit1adbee226e64dabe85e5775e62865b6a42096c04 (patch)
tree81a7f7a57c1503dde5f699054f4541cab42c8624 /Lib/logging
parentd45a278b934a4a6f317c3c727ed45f5667d43ed5 (diff)
downloadcpython-1adbee226e64dabe85e5775e62865b6a42096c04.zip
cpython-1adbee226e64dabe85e5775e62865b6a42096c04.tar.gz
cpython-1adbee226e64dabe85e5775e62865b6a42096c04.tar.bz2
Added checks for tuples in dictConfig.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/config.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index 7a2188f..21e10c1 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -474,6 +474,12 @@ class BaseConfigurator(object):
setattr(result, name, value)
return result
+ def as_tuple(self, value):
+ """Utility function which converts lists to tuples."""
+ if isinstance(value, list):
+ value = tuple(value)
+ return value
+
class DictConfigurator(BaseConfigurator):
"""
Configure logging using a dictionary-like object to describe the
@@ -688,6 +694,12 @@ class DictConfigurator(BaseConfigurator):
except StandardError, e:
raise ValueError('Unable to set target handler '
'%r: %s' % (config['target'], e))
+ elif issubclass(klass, logging.handlers.SMTPHandler) and\
+ 'mailhost' in config:
+ config['mailhost'] = self.as_tuple(config['mailhost'])
+ elif issubclass(klass, logging.handlers.SysLogHandler) and\
+ 'address' in config:
+ config['address'] = self.as_tuple(config['address'])
factory = klass
kwargs = dict([(k, config[k]) for k in config if valid_ident(k)])
try: