Commit c4677db0 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

erp5_core: ScriptConstrant support Consistency Message side by side with strings

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