setattr instead of _setattr
This commit is contained in:
parent
f4307b9122
commit
8a21d49948
@ -199,16 +199,22 @@ class SubConfig(object):
|
||||
# attribute methods
|
||||
def __setattr__(self, name, value):
|
||||
"attribute notation mechanism for the setting of the value of an option"
|
||||
self._setattr(name, value)
|
||||
self.setattr(name, value)
|
||||
|
||||
def _setattr(self, name, value, force_permissive=False, not_raises=False):
|
||||
"""use setattr instead of _setattr
|
||||
"""
|
||||
self.setattr(name, value, force_permissive=force_permissive,
|
||||
not_raises=not_raises)
|
||||
|
||||
def setattr(self, name, value, force_permissive=False, not_raises=False):
|
||||
if name.startswith('_impl_'):
|
||||
object.__setattr__(self, name, value)
|
||||
return
|
||||
if '.' in name: # pragma: optional cover
|
||||
homeconfig, name = self.cfgimpl_get_home_by_path(name)
|
||||
return homeconfig._setattr(name, value, force_permissive,
|
||||
not_raises)
|
||||
return homeconfig.setattr(name, value, force_permissive,
|
||||
not_raises)
|
||||
context = self._cfgimpl_get_context()
|
||||
child = self.cfgimpl_get_description().__getattr__(name,
|
||||
context=context)
|
||||
@ -218,7 +224,7 @@ class SubConfig(object):
|
||||
not isinstance(child, DynSymLinkOption): # pragma: no dynoptiondescription cover
|
||||
path = context.cfgimpl_get_description().impl_get_path_by_opt(
|
||||
child._impl_getopt())
|
||||
context._setattr(path, value, force_permissive, not_raises)
|
||||
context.setattr(path, value, force_permissive, not_raises)
|
||||
else:
|
||||
subpath = self._get_subpath(name)
|
||||
self.cfgimpl_get_values().setitem(child, value, subpath,
|
||||
@ -756,7 +762,7 @@ class GroupConfig(_CommonConfig):
|
||||
elif isinstance(child, GroupConfig):
|
||||
child.set_value(path, value)
|
||||
else:
|
||||
child._setattr(path, value, not_raises=True)
|
||||
child.setattr(path, value, not_raises=True)
|
||||
|
||||
def find_firsts(self, byname=None, bypath=undefined, byoption=undefined,
|
||||
byvalue=undefined, raise_if_not_found=True, _sub=False,
|
||||
|
Loading…
Reference in New Issue
Block a user