fill for multi types with None value

This commit is contained in:
gwen 2012-07-05 09:17:15 +02:00
parent 52bc3f6507
commit 098df1ba76
1 changed files with 15 additions and 11 deletions

View File

@ -198,12 +198,13 @@ class Config(object):
# special owners # special owners
if owner in special_owners: if owner in special_owners:
value = self._cfgimpl_values[name] value = self._cfgimpl_values[name]
if opt_or_descr.is_multi(): if value != None:
if owner == 'fill' and None not in value: if opt_or_descr.is_multi():
return value if owner == 'fill' and None not in value:
else: return value
if owner == 'fill' and value != None: else:
return value if owner == 'fill':
return value
result = special_owner_factory(name, owner, result = special_owner_factory(name, owner,
value=value, value=value,
callback=opt_or_descr.getcallback(), callback=opt_or_descr.getcallback(),
@ -220,11 +221,14 @@ class Config(object):
' for option {0}'.format(name)) ' for option {0}'.format(name))
if opt_or_descr.is_multi(): if opt_or_descr.is_multi():
_result = [] if value == None:
for val in value: _result = [result]
if val == None: else:
val = result _result = []
_result.append(val) for val in value:
if val == None:
val = result
_result.append(val)
else: else:
_result = result _result = result
return _result return _result