Commit 2f116cc2 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5: Ensure only the proper System Preference is enabled

parent 7488529b
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
ensure the site configuration is set. ensure the site configuration is set.
""" """
if context.getPortalType() not in [ "System Preference"]: if context.getPortalType() not in ["System Preference"]:
return [] return []
if context.getPreferenceState() != "global": if context.getPreferenceState() != "global":
...@@ -11,6 +11,12 @@ if context.getPreferenceState() != "global": ...@@ -11,6 +11,12 @@ if context.getPreferenceState() != "global":
error_list = [] error_list = []
if context.getId() != "slapos_default_system_preference":
error_list.append(
"The Default System preference globally enabled shouldn't be %s but slapos_default_system_preference" % context.getId())
if fixit:
context.disable(comment="Disabled by PreferenceTool_checkSystemPreferenceConsistency")
preference_method_list = [ preference_method_list = [
"getPreferredHateoasUrl", "getPreferredHateoasUrl",
"getPreferredPayzenPaymentServiceReference", "getPreferredPayzenPaymentServiceReference",
...@@ -20,7 +26,6 @@ preference_method_list = [ ...@@ -20,7 +26,6 @@ preference_method_list = [
] ]
for method_id in preference_method_list: for method_id in preference_method_list:
result = getattr(context.portal_preferences, method_id)() result = getattr(context.portal_preferences, method_id)()
if result in [None, ""]: if result in [None, ""]:
error_list.append( error_list.append(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment