--- a/src/pyams_form/form.py Fri Oct 04 12:53:19 2019 +0200
+++ b/src/pyams_form/form.py Fri Oct 04 12:54:42 2019 +0200
@@ -196,7 +196,7 @@
result.extend(form.widgets.errors)
return result
- def add_error(self, error, widget):
+ def add_error(self, error, widget, status=None):
if isinstance(error, str):
error = Invalid(error)
if isinstance(widget, str):
@@ -209,7 +209,7 @@
self.widgets.errors += (snippet,)
translate = self.request.localizer.translate
if not self.status:
- self.status = translate(self.formErrorsMessage)
+ self.status = translate(status or self.formErrorsMessage)
self.status += '\n{0}'.format(translate(error.args[0]))
def update_content(self, content, data):
--- a/src/pyams_form/interfaces/form.py Fri Oct 04 12:53:19 2019 +0200
+++ b/src/pyams_form/interfaces/form.py Fri Oct 04 12:54:42 2019 +0200
@@ -130,11 +130,12 @@
is_dialog = Attribute("Check to know if current form is in a modal dialog")
- def add_error(self, error, widget):
+ def add_error(self, error, widget, status=None):
"""Add error to current form status
:param error: error can be defined as a simple string or as an error instance.
:param widget: widget can be a widget name or a Widget instance.
+ :param status: if specified, allows to define a custom form status.
"""
def get_form_action(self):