freeze() in read_write method
This commit is contained in:
parent
9e417334d4
commit
a2f9beb9f4
|
@ -180,7 +180,7 @@ class Config(object):
|
||||||
if not isinstance(opt_or_descr, Option) and \
|
if not isinstance(opt_or_descr, Option) and \
|
||||||
not isinstance(opt_or_descr, OptionDescription):
|
not isinstance(opt_or_descr, OptionDescription):
|
||||||
raise TypeError('Unexpected object: {0}'.format(repr(opt_or_descr)))
|
raise TypeError('Unexpected object: {0}'.format(repr(opt_or_descr)))
|
||||||
properties = opt_or_descr.properties
|
properties = copy(opt_or_descr.properties)
|
||||||
for proper in properties:
|
for proper in properties:
|
||||||
if not self._cfgimpl_toplevel._cfgimpl_has_property(proper):
|
if not self._cfgimpl_toplevel._cfgimpl_has_property(proper):
|
||||||
properties.remove(proper)
|
properties.remove(proper)
|
||||||
|
@ -434,7 +434,7 @@ class Config(object):
|
||||||
return rootconfig._cfgimpl_mandatory
|
return rootconfig._cfgimpl_mandatory
|
||||||
|
|
||||||
def cfgimpl_read_only(self):
|
def cfgimpl_read_only(self):
|
||||||
# hung up on freeze, hidden and disabled concepts
|
# convenience method to freeze, hidde and disable
|
||||||
self.cfgimpl_freeze()
|
self.cfgimpl_freeze()
|
||||||
rootconfig = self._cfgimpl_get_toplevel()
|
rootconfig = self._cfgimpl_get_toplevel()
|
||||||
rootconfig.cfgimpl_disable_property('hidden')
|
rootconfig.cfgimpl_disable_property('hidden')
|
||||||
|
@ -442,8 +442,8 @@ class Config(object):
|
||||||
rootconfig._cfgimpl_mandatory = True
|
rootconfig._cfgimpl_mandatory = True
|
||||||
|
|
||||||
def cfgimpl_read_write(self):
|
def cfgimpl_read_write(self):
|
||||||
# hung up on freeze, hidden and disabled concepts
|
# convenience method to freeze, hidde and disable
|
||||||
self.cfgimpl_unfreeze()
|
self.cfgimpl_freeze()
|
||||||
rootconfig = self._cfgimpl_get_toplevel()
|
rootconfig = self._cfgimpl_get_toplevel()
|
||||||
rootconfig.cfgimpl_enable_property('hidden')
|
rootconfig.cfgimpl_enable_property('hidden')
|
||||||
rootconfig.cfgimpl_enable_property('disabled')
|
rootconfig.cfgimpl_enable_property('disabled')
|
||||||
|
|
|
@ -404,12 +404,11 @@ class OptionDescription(HiddenBaseType, DisabledBaseType):
|
||||||
attr = option._name
|
attr = option._name
|
||||||
if attr.startswith('_cfgimpl'):
|
if attr.startswith('_cfgimpl'):
|
||||||
continue
|
continue
|
||||||
value = getattr(self, attr)
|
if isinstance(option, OptionDescription):
|
||||||
if isinstance(value, OptionDescription):
|
|
||||||
if include_groups:
|
if include_groups:
|
||||||
paths.append('.'.join(currpath + [attr]))
|
paths.append('.'.join(currpath + [attr]))
|
||||||
currpath.append(attr)
|
currpath.append(attr)
|
||||||
paths += value.getpaths(include_groups=include_groups,
|
paths += option.getpaths(include_groups=include_groups,
|
||||||
currpath=currpath)
|
currpath=currpath)
|
||||||
currpath.pop()
|
currpath.pop()
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue