I use Plone with dexterity, and I check 2 related fields using an invariant decorator. Everything works, but ... I would like to move the general error message to one specific field.
How can i do this? I found Martin Aspelie's three-year suggestion about how cool it would be to do this:
http://plone.293351.n2.nabble.com/plone-app-form-does-not-display-invariant-errors-td348710.html
but they did not come out with a decision.
I also found a way to do this, but it's ugly: putting this code on the form refresh method:
for widget in widgets: name = widget.context.getName() if errors: for error in errors: if isinstance(error, Invalid) and name in error.args[1:]: if widget._error is None: widget._error = error
Is there a lower-level implementation that allows you to pass field names to the raised Invalid and does not require a loop through all fields and all errors for each field?!?
source share