diff --git a/localconfig/manager.py b/localconfig/manager.py index 77119f6..36b70be 100644 --- a/localconfig/manager.py +++ b/localconfig/manager.py @@ -46,6 +46,14 @@ def __setattr__(self, key, value): else: return self._config.set(self._section, key, value) + def __contains__(self, key): + """ + Determine if this section has specified attribute + + :param str key: Config key to look for + """ + return (self._section, key) in self._config._dot_keys + def __iter__(self): return self._config.items(self._section) @@ -355,6 +363,7 @@ def __getattr__(self, section): """ self._read_sources() + section = section.lower() if section in self._dot_keys: return self.SectionAccessor(self, section) diff --git a/setup.py b/setup.py index 6feb32f..a1521a6 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name='localconfig', - version='1.1.5', + version='1.1.6', author='Max Zheng', author_email='maxzheng.os @t gmail.com',