fill for multi types with None value
authorgwen <gremond@cadoles.com>
Thu, 5 Jul 2012 07:17:15 +0000 (09:17 +0200)
committergwen <gremond@cadoles.com>
Thu, 5 Jul 2012 07:17:15 +0000 (09:17 +0200)
config.py

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