Commit 999c5bdf authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Cédric Le Ninivin

erp5_core: ScriptConstrant support Consistency Message side by side with strings

parent a575b749
......@@ -27,6 +27,7 @@
##############################################################################
from Products.ERP5Type.mixin.constraint import ConstraintMixin
from Products.ERP5Type.ConsistencyMessage import ConsistencyMessage
class ScriptConstraint(ConstraintMixin):
"""
......@@ -38,7 +39,6 @@ class ScriptConstraint(ConstraintMixin):
def _createConsistencyMessage(self, object_relative_url, message, mapping):
# XXX If I put in the right place I have TypeError: 'NoneType' object is not callable
from Products.ERP5Type.ConsistencyMessage import ConsistencyMessage
return ConsistencyMessage(self,
object_relative_url=object_relative_url,
message=message,
......@@ -58,6 +58,9 @@ class ScriptConstraint(ConstraintMixin):
createConsistencyMessage = self._createConsistencyMessage
message_list = []
for item in method(fixit=fixit, **kw):
if isinstance(item, ConsistencyMessage):
message_list.append(item)
continue
if isinstance(item, (tuple, list)) and len(item) == 2:
message, mapping = item
else:
......
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