Added optional "factory" argument to "NamedWidgetsGroup" function
authorThierry Florac <thierry.florac@onf.fr>
Fri, 27 Apr 2018 18:17:26 +0200
changeset 100 6584696a7e48
parent 99 a0ab0d005b32
child 101 ba1d62478119
Added optional "factory" argument to "NamedWidgetsGroup" function
src/pyams_form/group.py
--- a/src/pyams_form/group.py	Fri Apr 27 18:16:21 2018 +0200
+++ b/src/pyams_form/group.py	Fri Apr 27 18:17:26 2018 +0200
@@ -137,10 +137,10 @@
 
 def NamedWidgetsGroup(form, id, widgets, names=(), bordered=True, fieldset_class=None, legend=None, help=None,
                       css_class='', switch=False, checkbox_switch=False, checkbox_field=None, checkbox_mode='hide',
-                      hide_if_empty=False):
+                      hide_if_empty=False, factory=FormWidgetsGroup):
     """Create a widgets group based on widgets names"""
-    return FormWidgetsGroup(form, id, [widgets.get(name) for name in names], bordered, fieldset_class, legend, help,
-                            css_class, switch, checkbox_switch, checkbox_field, checkbox_mode, hide_if_empty)
+    return factory(form, id, [widgets.get(name) for name in names], bordered, fieldset_class, legend, help,
+                   css_class, switch, checkbox_switch, checkbox_field, checkbox_mode, hide_if_empty)
 
 
 @implementer(IGroupsBasedForm)