Commit cc54f449 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_hal_json_style] FormBox should not crash if form_id is not defined

parent a52986b1
...@@ -774,7 +774,12 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None, k ...@@ -774,7 +774,12 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None, k
field=field, REQUEST=REQUEST) field=field, REQUEST=REQUEST)
embedded_document['_debug'] = "Different context" embedded_document['_debug'] = "Different context"
# get embedded form definition # get embedded form definition
embedded_form = getattr(formbox_context, field.get_value('formbox_target_id')) embedded_form_id = field.get_value('formbox_target_id')
embedded_form = None
if embedded_form_id:
embedded_form = getattr(formbox_context, embedded_form_id, None)
if embedded_form is None:
return
# renderForm mutates `embedded_document` therefor no return/assignment # renderForm mutates `embedded_document` therefor no return/assignment
renderForm(formbox_context, embedded_form, embedded_document, key_prefix=key) renderForm(formbox_context, embedded_form, embedded_document, key_prefix=key)
# fix editability which is hard-coded to 0 in `renderForm` implementation # fix editability which is hard-coded to 0 in `renderForm` implementation
......
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