pass force_permissive to slave for a master or to master for a slave
[tiramisu.git] / tiramisu / option / masterslave.py
index ee72ec1..09c77b3 100644 (file)
@@ -162,7 +162,8 @@ class MasterSlaves(object):
                                             force_properties,
                                             validate_properties,
                                             None)  # not undefined
-        return self.get_slave_value(values, opt, value, validate, validate_properties)
+        return self.get_slave_value(values, opt, value, validate,
+                                    validate_properties, force_permissive)
 
     def setitem(self, values, opt, value, path):
         if self.is_master(opt):
@@ -183,13 +184,14 @@ class MasterSlaves(object):
                                        opt.impl_getname(), opt, setitem=True)
 
     def get_length(self, values, opt, validate=True, slave_path=undefined,
-                   slave_value=undefined):
+                   slave_value=undefined, force_permissive=False):
         """get master len with slave option"""
         masterp = self.getmaster(opt).impl_getpath(values._getcontext())
         if slave_value is undefined:
             slave_path = undefined
-        return len(self.getitem(values, self.getmaster(opt), masterp, validate, False,
-                                None, True, slave_path, slave_value))
+        return len(self.getitem(values, self.getmaster(opt), masterp, validate,
+                                force_permissive, None, True, slave_path,
+                                slave_value))
 
     def validate_slave_length(self, masterlen, valuelen, name, opt, setitem=False):
         if valuelen > masterlen or (valuelen < masterlen and setitem):  # pragma: optional cover
@@ -200,7 +202,7 @@ class MasterSlaves(object):
                                    name, self.getmaster(opt).impl_getname()))
 
     def get_slave_value(self, values, opt, value, validate=True,
-                        validate_properties=True):
+                        validate_properties=True, force_permissive=False):
         """
         if master has length 0:
             return []
@@ -224,7 +226,8 @@ class MasterSlaves(object):
         """
         #if slave, had values until master's one
         path = opt.impl_getpath(values._getcontext())
-        masterlen = self.get_length(values, opt, validate, path, value)
+        masterlen = self.get_length(values, opt, validate, path, value,
+                                    force_permissive)
         valuelen = len(value)
         if validate:
             self.validate_slave_length(masterlen, valuelen, opt.impl_getname(), opt)