add force_permissive to config __iter__

This commit is contained in:
2014-10-26 10:26:23 +01:00
parent a130cff4bf
commit 4310d59991
5 changed files with 29 additions and 8 deletions

View File

@ -97,7 +97,7 @@ class SubConfig(object):
# return not self == other
# ______________________________________________________________________
def __iter__(self):
def __iter__(self, force_permissive=False):
"""Pythonesque way of parsing group's ordered options.
iteration only on Options (not OptionDescriptions)"""
for child in self.cfgimpl_get_description()._impl_getchildren(
@ -105,7 +105,8 @@ class SubConfig(object):
if not child.impl_is_optiondescription():
try:
name = child.impl_getname()
yield name, getattr(self, name)
yield name, self.getattr(name,
force_permissive=force_permissive)
except GeneratorExit: # pragma: optional cover
raise StopIteration
except PropertiesOptionError: # pragma: optional cover

View File

@ -300,7 +300,7 @@ class Values(object):
return value
def __setitem__(self, opt, value): # pragma: optional cover
raise ValueError(_('you should only set value with config'))
raise ConfigError(_('you should only set value with config'))
def setitem(self, opt, value, path, force_permissive=False,
is_write=True):