Commit 9c87b65d authored by Jérome Perrin's avatar Jérome Perrin
parent bde5a88d
Pipeline #28412 failed with stage
in 0 seconds
...@@ -175,6 +175,11 @@ class StaticValue: ...@@ -175,6 +175,11 @@ class StaticValue:
return value return value
class TALESValue(StaticValue): class TALESValue(StaticValue):
# Errors during TALES are hidden by default, this is a mistake from long time
# ago. We expose this flag to set it to False during tests so that TALES errors
# are not tolerated in tests.
tolerate_errors = True
def __init__(self, tales_expr): def __init__(self, tales_expr):
self.tales_expr = tales_expr self.tales_expr = tales_expr
...@@ -225,6 +230,8 @@ class TALESValue(StaticValue): ...@@ -225,6 +230,8 @@ class TALESValue(StaticValue):
except (ConflictError, RuntimeError, Redirect, NotFound): except (ConflictError, RuntimeError, Redirect, NotFound):
raise raise
except: except:
if not self.tolerate_errors:
raise
# We add this safety exception to make sure we always get # We add this safety exception to make sure we always get
# something reasonable rather than generate plenty of errors # something reasonable rather than generate plenty of errors
LOG('ERP5Form', PROBLEM, LOG('ERP5Form', PROBLEM,
......
...@@ -1616,5 +1616,8 @@ def fortify(): ...@@ -1616,5 +1616,8 @@ def fortify():
activity_kw, *args, **kw) activity_kw, *args, **kw)
Message.__init__ = __init__ Message.__init__ = __init__
from Products.ERP5Form.Form import TALESValue
assert TALESValue.tolerate_errors
TALESValue.tolerate_errors = False
fortify() fortify()
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