Commit 026cf7d4 authored by Tomáš Peterka's avatar Tomáš Peterka

[hal_json] Improve support for rendering Forms in callDialogMethod by inspecting the meta_type

parent aaa8d69a
...@@ -268,9 +268,19 @@ if True: ...@@ -268,9 +268,19 @@ if True:
# RJS: If skin selection is different than Hal* then ERP5Document_getHateoas # RJS: If skin selection is different than Hal* then ERP5Document_getHateoas
# does not exist and we call form method directly # does not exist and we call form method directly
# If update_method was clicked and the target is the original dialog form then we must not call dialog_form directly because it returns HTML
if clean_kw.get("portal_skin", context.getPortalObject().portal_skins.getDefaultSkin()) not in ("Hal", "HalRestricted"): if clean_kw.get("portal_skin", context.getPortalObject().portal_skins.getDefaultSkin()) not in ("Hal", "HalRestricted"):
return dialog_form(**kw) return dialog_form(**kw)
# dialog_form can be anything from a pure python function, class method to ERP5 Form or Python Script
try:
meta_type = dialog_form.meta_type
except AttributeError:
meta_type = ""
if meta_type == "ERP5 Form":
return context.ERP5Document_getHateoas(REQUEST=request, form=dialog_form, mode="form") return context.ERP5Document_getHateoas(REQUEST=request, form=dialog_form, mode="form")
return dialog_form(**kw)
return getattr(context, dialog_method)(**kw) return getattr(context, dialog_method)(**kw)
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