diff options
| author | Mark McLoughlin <markmc@redhat.com> | 2012-11-23 15:12:12 +0000 |
|---|---|---|
| committer | Mark McLoughlin <markmc@redhat.com> | 2012-11-23 15:14:53 +0000 |
| commit | 5e9503bf9934f1ccc15985ee29eb76dc04ebad6a (patch) | |
| tree | 708b966951a8b09c2a5761529da26e1b3f25643f /openstack/common | |
| parent | b4c0767e5529eb5d58aed90643354dbee83efefe (diff) | |
| download | oslo-5e9503bf9934f1ccc15985ee29eb76dc04ebad6a.tar.gz oslo-5e9503bf9934f1ccc15985ee29eb76dc04ebad6a.tar.xz oslo-5e9503bf9934f1ccc15985ee29eb76dc04ebad6a.zip | |
Hide the GroupAttr conf and group attributes
There's no reason why an option group shouldn't have options called
'group' or 'conf'.
Add a test case which would have failed because the 'conf' attribute
would have been a ConfigOpts instance and fix it by making those
attributes private.
Change-Id: Ic3e41a546c0d1b7b6aae04e1dbac2933ac661f57
Diffstat (limited to 'openstack/common')
| -rw-r--r-- | openstack/common/cfg.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/openstack/common/cfg.py b/openstack/common/cfg.py index e967c61..beba0a5 100644 --- a/openstack/common/cfg.py +++ b/openstack/common/cfg.py @@ -1572,12 +1572,12 @@ class ConfigOpts(collections.Mapping): :param conf: a ConfigOpts object :param group: an OptGroup object """ - self.conf = conf - self.group = group + self._conf = conf + self._group = group def __getattr__(self, name): """Look up an option value and perform template substitution.""" - return self.conf._get(name, self.group) + return self._conf._get(name, self._group) def __getitem__(self, key): """Look up an option value and perform string substitution.""" @@ -1585,16 +1585,16 @@ class ConfigOpts(collections.Mapping): def __contains__(self, key): """Return True if key is the name of a registered opt or group.""" - return key in self.group._opts + return key in self._group._opts def __iter__(self): """Iterate over all registered opt and group names.""" - for key in self.group._opts.keys(): + for key in self._group._opts.keys(): yield key def __len__(self): """Return the number of options and option groups.""" - return len(self.group._opts) + return len(self._group._opts) class StrSubWrapper(object): |
