doesn't check follower requirement with an other follower or a leader if idx is None (fixes #3)
This commit is contained in:
@ -397,7 +397,10 @@ class BaseOption(Base):
|
||||
super(BaseOption, self).__setattr__(name, value)
|
||||
|
||||
def impl_getpath(self) -> str:
|
||||
return self._path
|
||||
try:
|
||||
return self._path
|
||||
except AttributeError:
|
||||
raise AttributeError(_('"{}" not part of any Config').format(self.impl_get_display_name()))
|
||||
|
||||
def impl_has_callback(self) -> bool:
|
||||
"to know if a callback has been defined or not"
|
||||
|
@ -388,13 +388,13 @@ class Option(BaseOption):
|
||||
def impl_is_leader(self):
|
||||
leadership = self.impl_get_leadership()
|
||||
if leadership is None:
|
||||
return leadership
|
||||
return self.impl_get_leadership().is_leader(self)
|
||||
return False
|
||||
return leadership.is_leader(self)
|
||||
|
||||
def impl_is_follower(self):
|
||||
leadership = self.impl_get_leadership()
|
||||
if leadership is None:
|
||||
return leadership
|
||||
return False
|
||||
return not leadership.is_leader(self)
|
||||
|
||||
def impl_get_leadership(self):
|
||||
|
@ -523,6 +523,10 @@ class Settings(object):
|
||||
is_indexed = False
|
||||
if option.impl_is_follower():
|
||||
idx = option_bag.index
|
||||
if idx is None:
|
||||
continue
|
||||
elif option.impl_is_leader() and option_bag.index is None:
|
||||
continue
|
||||
elif option.impl_is_multi() and option_bag.index is not None:
|
||||
is_indexed = True
|
||||
config_bag = option_bag.config_bag.copy()
|
||||
|
Reference in New Issue
Block a user