From d7ddf2896f0aaa42ae1ca2b5d3c492a37ca3be33 Mon Sep 17 00:00:00 2001 From: Erik Bernoth Date: Sat, 22 Nov 2014 15:25:16 +0100 Subject: [PATCH] Show real class name When someone is extending ConfigObj the String should show the actual class name as well. e.g.: ``` >> class MyConfigObj(ConfigObj): ... pass >> o=MyConfigObj() >> o MyConfigObj({}) ``` instead of ``` >> o ConfigObj({}) ``` --- configobj.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configobj.py b/configobj.py index 7c972a4..badfbec 100644 --- a/configobj.py +++ b/configobj.py @@ -1363,9 +1363,9 @@ def _getval(key): return self[key] except MissingInterpolationOption: return dict.__getitem__(self, key) - return ('ConfigObj({%s})' % + return ('%s({%s})' % (self.__class__.__name__, ', '.join([('%s: %s' % (repr(key), repr(_getval(key)))) - for key in (self.scalars + self.sections)])) + for key in (self.scalars + self.sections)]))) def _handle_bom(self, infile):