add mode for leader variable
This commit is contained in:
parent
763c7a4fb8
commit
940b20f5d9
2 changed files with 12 additions and 8 deletions
|
@ -227,21 +227,22 @@ class Annotator(Walk):
|
||||||
if isinstance(variable, self.objectspace.family):
|
if isinstance(variable, self.objectspace.family):
|
||||||
if not hasattr(variable, 'mode'):
|
if not hasattr(variable, 'mode'):
|
||||||
variable.mode = self.objectspace.rougailconfig['default_family_mode']
|
variable.mode = self.objectspace.rougailconfig['default_family_mode']
|
||||||
elif idx == 0 and is_leadership:
|
#elif idx == 0 and is_leadership:
|
||||||
variable.mode = None
|
# variable.mode = None
|
||||||
continue
|
# if variable.path == 'general.piwigo.users.piwigo_users':
|
||||||
|
# print(variable.path)
|
||||||
|
# continue
|
||||||
else:
|
else:
|
||||||
self._change_variable_mode(variable, family_mode, is_leadership)
|
self._change_variable_mode(variable, family_mode, is_leadership)
|
||||||
if self.modes[min_variable_mode] > self.modes[variable.mode]:
|
if self.modes[min_variable_mode] > self.modes[variable.mode]:
|
||||||
min_variable_mode = variable.mode
|
min_variable_mode = variable.mode
|
||||||
if not isinstance(family, (self.objectspace.family, self.objectspace.variables)) or \
|
if not isinstance(family, (self.objectspace.family, self.objectspace.variables)):
|
||||||
is_leadership:
|
# it's Variable, Service, ...
|
||||||
# it's Variable, Service, ... and leadership
|
|
||||||
return
|
return
|
||||||
if not hasattr(family, 'mode'):
|
if not hasattr(family, 'mode'):
|
||||||
# set the lower variable mode to family
|
# set the lower variable mode to family
|
||||||
self._set_auto_mode(family, min_variable_mode)
|
self._set_auto_mode(family, min_variable_mode)
|
||||||
if family.mode != min_variable_mode:
|
if not is_leadership and family.mode != min_variable_mode:
|
||||||
msg = _(f'the family "{family.name}" is in "{family.mode}" mode but variables and '
|
msg = _(f'the family "{family.name}" is in "{family.mode}" mode but variables and '
|
||||||
f'families inside have the higher modes "{min_variable_mode}"')
|
f'families inside have the higher modes "{min_variable_mode}"')
|
||||||
raise DictConsistencyError(msg, 62, family.xmlfiles)
|
raise DictConsistencyError(msg, 62, family.xmlfiles)
|
||||||
|
|
|
@ -66,7 +66,10 @@ class Annotator(Walk):
|
||||||
if variable.multi is not True:
|
if variable.multi is not True:
|
||||||
msg = _(f'the variable "{variable.name}" in a leadership must be multi')
|
msg = _(f'the variable "{variable.name}" in a leadership must be multi')
|
||||||
raise DictConsistencyError(msg, 32, variable.xmlfiles)
|
raise DictConsistencyError(msg, 32, variable.xmlfiles)
|
||||||
family.hidden = variable.hidden
|
if variable.hidden:
|
||||||
|
family.hidden = variable.hidden
|
||||||
|
elif family.hidden:
|
||||||
|
variable.hidden = family.hidden
|
||||||
if variable.hidden:
|
if variable.hidden:
|
||||||
variable.frozen = True
|
variable.frozen = True
|
||||||
variable.force_default_on_freeze = True
|
variable.force_default_on_freeze = True
|
||||||
|
|
Loading…
Reference in a new issue