generic properties api
This commit is contained in:
parent
e2bcac1c01
commit
9604fd15ec
|
@ -138,37 +138,22 @@ class Config(object):
|
||||||
def _cfgimpl_has_properties(self):
|
def _cfgimpl_has_properties(self):
|
||||||
return bool(len(self._cfgimpl_properties))
|
return bool(len(self._cfgimpl_properties))
|
||||||
|
|
||||||
def cfgimpl_hide(self):
|
def _cfgimpl_has_property(self, propname):
|
||||||
|
return propname in self._cfgimpl_properties
|
||||||
|
|
||||||
|
def cfgimpl_enable_property(self, propname):
|
||||||
if self._cfgimpl_parent != None:
|
if self._cfgimpl_parent != None:
|
||||||
raise MethodCallError("this method root_hide() shall not be"
|
raise MethodCallError("this method root_hide() shall not be"
|
||||||
"used with non-root Config() object")
|
"used with non-root Config() object")
|
||||||
rootconfig = self._cfgimpl_get_toplevel()
|
if propname not in in self._cfgimpl_properties:
|
||||||
if 'hidden' not in rootconfig._cfgimpl_properties:
|
self._cfgimpl_properties.append(propname)
|
||||||
rootconfig._cfgimpl_properties.append('hidden')
|
|
||||||
|
|
||||||
def cfgimpl_show(self):
|
def cfgimpl_disable_property(self, propname):
|
||||||
if self._cfgimpl_parent != None:
|
if self._cfgimpl_parent != None:
|
||||||
raise MethodCallError("this method root_hide() shall not be"
|
raise MethodCallError("this method root_hide() shall not be"
|
||||||
"used with non-root Config() object")
|
"used with non-root Config() object")
|
||||||
rootconfig = self._cfgimpl_get_toplevel()
|
if self._cfgimpl_has_property(propname):
|
||||||
if 'hidden' in rootconfig._cfgimpl_properties:
|
self.properties.remove(propname)
|
||||||
rootconfig._cfgimpl_properties.remove('hidden')
|
|
||||||
|
|
||||||
def cfgimpl_disable(self):
|
|
||||||
if self._cfgimpl_parent != None:
|
|
||||||
raise MethodCallError("this method root_hide() shall not be"
|
|
||||||
"used with non-root Confit() object")
|
|
||||||
rootconfig = self._cfgimpl_get_toplevel()
|
|
||||||
if 'disabled' not in rootconfig._cfgimpl_properties:
|
|
||||||
rootconfig._cfgimpl_properties.append('disabled')
|
|
||||||
|
|
||||||
def cfgimpl_enable(self):
|
|
||||||
if self._cfgimpl_parent != None:
|
|
||||||
raise MethodCallError("this method root_hide() shall not be"
|
|
||||||
"used with non-root Confit() object")
|
|
||||||
rootconfig = self._cfgimpl_get_toplevel()
|
|
||||||
if 'disabled' in rootconfig._cfgimpl_properties:
|
|
||||||
rootconfig._cfgimpl_properties.remove('disabled')
|
|
||||||
|
|
||||||
def cfgimpl_non_mandatory(self):
|
def cfgimpl_non_mandatory(self):
|
||||||
if self._cfgimpl_parent != None:
|
if self._cfgimpl_parent != None:
|
||||||
|
|
Loading…
Reference in New Issue