Skip to content

Commit

Permalink
Compute fields when they're needed so that events can still modify th…
Browse files Browse the repository at this point in the history
…e data
  • Loading branch information
JeffersonBledsoe committed Jan 20, 2025
1 parent aa62f3c commit b258131
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/collective/volto/formsupport/adapters/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ def __init__(self, context, request):
if self.block_id:
self.block = self.get_block_data(block_id=self.block_id)

self.fields = self.format_fields()

def __call__(self):
"""
Avoid XSS injections and other attacks.
Expand All @@ -46,7 +44,7 @@ def __call__(self):

self.validate_form()

for field in self.fields:
for field in self.filter_parameters():
field.validate(request=self.request)

return self.form_data
Expand Down Expand Up @@ -227,7 +225,7 @@ def filter_parameters(self):
"""
do not send attachments fields.
"""
return [field for field in self.fields if field.send_in_email]
return [field for field in self.format_fields() if field.send_in_email]

def format_fields(self):
fields_data = []
Expand Down

0 comments on commit b258131

Please sign in to comment.