add len for master

This commit is contained in:
Emmanuel Garette 2018-07-07 17:11:33 +02:00
parent 79c28038a5
commit d0f6a4dd31
1 changed files with 15 additions and 3 deletions

View File

@ -576,7 +576,16 @@ class TiramisuOptionValue(CommonTiramisuOption):
self.config_bag)
@count
def _len(self):
def _len_master(self):
"""length of master option (only for slave option)"""
option = self._get_option()
# for example if index is None
if '_length' not in vars(self):
self._length = self.subconfig.cfgimpl_get_length()
return self._length
@count
def _len_slave(self):
"""length of slave option (only for slave option)"""
option = self._get_option()
# for example if index is None
@ -589,8 +598,11 @@ class TiramisuOptionValue(CommonTiramisuOption):
return self._list
elif name == 'pop' and self._get_option().impl_is_master_slaves('master'):
return self._pop
elif name == 'len' and self._get_option().impl_is_master_slaves('slave'):
return self._len
elif name == 'len':
if self._get_option().impl_is_master_slaves('slave'):
return self._len_slave
if self._get_option().impl_is_master_slaves('master'):
return self._len_master
raise APIError(_('{} is unknown').format(name))
@count