report/generate.py: corrections
This commit is contained in:
parent
6d8137160c
commit
22860099ba
|
@ -61,9 +61,9 @@ def opt_rst_content(path, prefix, descr, value):
|
||||||
content.add(ListItem().join(Strong("path:"), Text(path)))
|
content.add(ListItem().join(Strong("path:"), Text(path)))
|
||||||
content.add(ListItem().join(Strong("parent config:"), Text(prefix)))
|
content.add(ListItem().join(Strong("parent config:"), Text(prefix)))
|
||||||
if isinstance(descr, ChoiceOption):
|
if isinstance(descr, ChoiceOption):
|
||||||
content.add(ListItem().join(Strong("possible values:"), Text(str(descr._values))))
|
content.add(ListItem().join(Strong("possible values:"), Text(str(descr.impl_get_values()))))
|
||||||
if not isinstance(descr, SymLinkOption):
|
if not isinstance(descr, SymLinkOption):
|
||||||
content.add(ListItem().join(Strong("mime type:"), Text(str(descr._opt_type))))
|
content.add(ListItem().join(Strong("mime type:"), Text(str(descr.__class__.__name__))))
|
||||||
content.add(ListItem().join(Strong("default value:"), Text(str(descr.impl_getdefault()))))
|
content.add(ListItem().join(Strong("default value:"), Text(str(descr.impl_getdefault()))))
|
||||||
content.add(ListItem().join(Strong("description:"), Text(str(descr.impl_get_information('doc')))))
|
content.add(ListItem().join(Strong("description:"), Text(str(descr.impl_get_information('doc')))))
|
||||||
content.add(ListItem().join(Strong("requirements:"), Text(str(descr._requires))))
|
content.add(ListItem().join(Strong("requirements:"), Text(str(descr._requires))))
|
||||||
|
|
|
@ -8,9 +8,9 @@ from .option import (ChoiceOption, BoolOption, IntOption, FloatOption,
|
||||||
FilenameOption)
|
FilenameOption)
|
||||||
|
|
||||||
|
|
||||||
__all__ = (MasterSlaves, OptionDescription, Option, SymLinkOption,
|
__all__ = ('MasterSlaves', 'OptionDescription', 'Option', 'SymLinkOption',
|
||||||
ChoiceOption, BoolOption, IntOption, FloatOption,
|
'ChoiceOption', 'BoolOption', 'IntOption', 'FloatOption',
|
||||||
StrOption, UnicodeOption, IPOption, PortOption,
|
'StrOption', 'UnicodeOption', 'IPOption', 'PortOption',
|
||||||
NetworkOption, NetmaskOption, BroadcastOption,
|
'NetworkOption', 'NetmaskOption', 'BroadcastOption',
|
||||||
DomainnameOption, EmailOption, URLOption, UsernameOption,
|
'DomainnameOption', 'EmailOption', 'URLOption', 'UsernameOption',
|
||||||
FilenameOption)
|
'FilenameOption')
|
||||||
|
|
|
@ -89,6 +89,16 @@ class MasterSlaves(object):
|
||||||
def getitem(self, values, opt, path, validate, force_permissive,
|
def getitem(self, values, opt, path, validate, force_permissive,
|
||||||
force_properties, validate_properties):
|
force_properties, validate_properties):
|
||||||
if opt == self.master:
|
if opt == self.master:
|
||||||
|
return self._getmaster(values, opt, path, validate,
|
||||||
|
force_permissive, force_properties,
|
||||||
|
validate_properties)
|
||||||
|
else:
|
||||||
|
return self._getslave(values, opt, path, validate,
|
||||||
|
force_permissive, force_properties,
|
||||||
|
validate_properties)
|
||||||
|
|
||||||
|
def _getmaster(self, values, opt, path, validate, force_permissive,
|
||||||
|
force_properties, validate_properties):
|
||||||
value = values._get_validated_value(opt, path, validate,
|
value = values._get_validated_value(opt, path, validate,
|
||||||
force_permissive,
|
force_permissive,
|
||||||
force_properties,
|
force_properties,
|
||||||
|
@ -109,7 +119,9 @@ class MasterSlaves(object):
|
||||||
except ConfigError:
|
except ConfigError:
|
||||||
pass
|
pass
|
||||||
return value
|
return value
|
||||||
else:
|
|
||||||
|
def _getslave(self, values, opt, path, validate, force_permissive,
|
||||||
|
force_properties, validate_properties):
|
||||||
value = values._get_validated_value(opt, path, validate,
|
value = values._get_validated_value(opt, path, validate,
|
||||||
force_permissive,
|
force_permissive,
|
||||||
force_properties,
|
force_properties,
|
||||||
|
|
|
@ -508,6 +508,13 @@ class Multi(list):
|
||||||
self._getcontext().cfgimpl_get_values()._setvalue(self.opt, self.path,
|
self._getcontext().cfgimpl_get_values()._setvalue(self.opt, self.path,
|
||||||
self)
|
self)
|
||||||
|
|
||||||
|
def __repr__(self, *args, **kwargs):
|
||||||
|
print args, kwargs
|
||||||
|
return super(Multi, self).__repr__(*args, **kwargs)
|
||||||
|
|
||||||
|
def __getitem__(self, y):
|
||||||
|
return super(Multi, self).__getitem__(y)
|
||||||
|
|
||||||
def append(self, value=undefined, force=False, setitem=True):
|
def append(self, value=undefined, force=False, setitem=True):
|
||||||
"""the list value can be updated (appened)
|
"""the list value can be updated (appened)
|
||||||
only if the option is a master
|
only if the option is a master
|
||||||
|
|
Loading…
Reference in New Issue