3
0
Fork 0

fix: raise better error if field widget serialization fails

and log a warning with traceback while we're at it
This commit is contained in:
Lance Edgar 2026-02-20 19:09:26 -06:00
parent faae9f1b0a
commit 485c503212
2 changed files with 20 additions and 1 deletions

View file

@ -587,6 +587,14 @@ class TestForm(WebTestCase):
html = form.render_vue_field("foo")
self.assertIn("something is wrong", html)
class BadWidget(deform.widget.Widget):
def serialize(self, **kwargs):
raise NotImplementedError
# widget serialization error
dform["foo"].widget = BadWidget()
self.assertRaises(RuntimeError, form.render_vue_field, "foo")
# add another field, but not to deform, so it should still
# display but with no widget
form.fields.append("zanzibar")