Improve repr(ConfigView): fix class name displayed

Use config.__class__.__name__ instead of "ConfigView" in __repr__().

Before:
>>> from beets import ui
>>> c
<ConfigView: root>
>>> c['foo']
<ConfigView: foo>

After:
>>> from beets import ui
>>> c
<LazyConfig: root>
>>> c['foo']
<Subview: foo>
This commit is contained in:
Bruno Cauet 2015-01-19 10:42:00 +01:00
parent 70ef96d565
commit d5e3ff2f48

View file

@ -208,7 +208,7 @@ class ConfigView(object):
raise NotImplementedError
def __repr__(self):
return '<ConfigView: %s>' % self.name
return '<{}: {}>'.format(self.__class__.__name__, self.name)
def __iter__(self):
"""Prevent list(config) from using __getitem__ and never halting"""