Skip to content

Commit

Permalink
Merge pull request #393 from collective/petschki-widgetrenderer-maurits
Browse files Browse the repository at this point in the history
Fix IEasyFormWidget marker for GroupForm widgets (take 2)
  • Loading branch information
MrTango committed Jan 13, 2023
2 parents c33922c + 45dee4c commit 77fbd60
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ Changelog
- Schemaeditor UI: close modals and reload fields(sets) when saving.
[petschki]

- Fix bug which did not render correctly GroupForm widgets (see #370)
[petschki]


4.1.0 (2022-08-10)
------------------
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"plone.schema",
"plone.schemaeditor>=4.0.0b1",
"plone.supermodel",
"plone.restapi",
"Products.CMFPlone>=6.0.0b1",
"Products.validation",
"setuptools",
Expand Down
9 changes: 6 additions & 3 deletions src/collective/easyform/browser/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,14 @@ def updateActions(self):
if "reset" in self.actions:
self.actions["reset"].title = self.context.resetLabel

def updateWidgets(self):
super(EasyFormForm, self).updateWidgets()
def markWidgets(self):
for w in self.widgets.values():
if not IEasyFormWidget.providedBy(w):
# add marker for custom widget renderer
alsoProvides(w, IEasyFormWidget)
for g in self.groups:
for w in g.widgets.values():
if not IEasyFormWidget.providedBy(w):
alsoProvides(w, IEasyFormWidget)

def formMaybeForceSSL(self):
"""Redirect to an https:// URL if the 'force SSL' option is on.
Expand All @@ -328,6 +330,7 @@ def update(self):
"""Update form - see interfaces.IForm"""
self.formMaybeForceSSL()
super(EasyFormForm, self).update()
self.markWidgets()
self.template = self.form_template
if self.request.method != "POST" or self.context.thanksPageOverride:
# go with all but default thank you page rendering
Expand Down

0 comments on commit 77fbd60

Please sign in to comment.