add len for master
This commit is contained in:
parent
79c28038a5
commit
d0f6a4dd31
|
@ -576,7 +576,16 @@ class TiramisuOptionValue(CommonTiramisuOption):
|
||||||
self.config_bag)
|
self.config_bag)
|
||||||
|
|
||||||
@count
|
@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)"""
|
"""length of slave option (only for slave option)"""
|
||||||
option = self._get_option()
|
option = self._get_option()
|
||||||
# for example if index is None
|
# for example if index is None
|
||||||
|
@ -589,8 +598,11 @@ class TiramisuOptionValue(CommonTiramisuOption):
|
||||||
return self._list
|
return self._list
|
||||||
elif name == 'pop' and self._get_option().impl_is_master_slaves('master'):
|
elif name == 'pop' and self._get_option().impl_is_master_slaves('master'):
|
||||||
return self._pop
|
return self._pop
|
||||||
elif name == 'len' and self._get_option().impl_is_master_slaves('slave'):
|
elif name == 'len':
|
||||||
return self._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))
|
raise APIError(_('{} is unknown').format(name))
|
||||||
|
|
||||||
@count
|
@count
|
||||||
|
|
Loading…
Reference in New Issue