Commit 716080f3 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_upgrader: Fix code to run checkConsistency to a specific constraint_type

constraint_type should be a string instead of a list.
parent 2bd817ff
......@@ -67,7 +67,7 @@ if alarm.sense() in (None, True):\n
\n
context.ERP5Site_checkUpgraderConsistency(fixit=True,\n
active_process=active_process,\n
filter_dict={"constraint_type": ["post_upgrade",]})\n
filter_dict={"constraint_type": "post_upgrade"})\n
\n
context.setEnabled(False)\n
return\n
......
......@@ -55,7 +55,7 @@
"""\n
context.ERP5Site_checkUpgraderConsistency(fixit=True,\n
active_process=context.newActiveProcess(),\n
filter_dict={"constraint_type": ["pre_upgrade"]})\n
filter_dict={"constraint_type": "pre_upgrade"})\n
\n
context.setEnabled(False)\n
return\n
......
......@@ -50,22 +50,19 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>traverse = context.getPortalObject().restrictedTraverse\n
active_process = traverse(active_process)\n
<value> <string>active_process = context.getPortalObject().restrictedTraverse(active_process)\n
\n
# We don\'t need check more if something is already inconsistent\n
if (active_process.ActiveProcess_sense() and not fixit):\n
if active_process.ActiveProcess_sense() and not fixit:\n
return\n
\n
constraint_message_list = context.checkConsistency(fixit=fixit,\n
filter=filter)\n
constraint_message_list = context.checkConsistency(\n
fixit=fixit, filter=filter,)\n
\n
if constraint_message_list and not active_process.getResultList():\n
summary = "%s Consistency - At least one inconsistent object found" % \\\n
(fixit and \'Fix\' or \'Check\')\n
active_process.postActiveResult(\n
severity=(not fixit and 1) or 0,\n
summary=summary,\n
severity=0 if fixit else 1,\n
summary="%s Consistency - At least one inconsistent object found" % (\'Fix\' if fixit else \'Check\', ),\n
detail=[m.message for m in constraint_message_list])\n
</string> </value>
</item>
......
......@@ -50,19 +50,27 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
constraint_type_per_type, _ = context.Base_getConstraintTypeListPerPortalType()\n
<value> <string>constraint_type_per_type, _ = context.Base_getConstraintTypeListPerPortalType()\n
constraint_type = filter_dict.get("constraint_type")\n
if not constraint_type:\n
return\n
\n
portal_type_list = []\n
append = portal_type_list.append\n
for portal_type, constraint_type_list in constraint_type_per_type.iteritems():\n
if not constraint_type and constraint_type not in constraint_type_list:\n
continue\n
method_kw = {\'fixit\': fixit,\n
\'filter\': filter_dict,\n
\'active_process\': active_process.getRelativeUrl()}\n
portal.portal_catalog.searchAndActivate(\'Base_postCheckConsistencyResult\',\n
portal_type=portal_type,\n
method_kw=method_kw)\n
if constraint_type in constraint_type_list:\n
append(portal_type)\n
\n
if portal_type_list:\n
context.getPortalObject().portal_catalog.searchAndActivate(\n
\'Base_postCheckConsistencyResult\',\n
portal_type=portal_type_list,\n
method_kw={\n
\'fixit\': fixit,\n
\'filter\': filter_dict,\n
\'active_process\': active_process.getRelativeUrl(),\n
},\n
)\n
</string> </value>
</item>
<item>
......
612
\ No newline at end of file
613
\ No newline at end of file
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