Skip to content

Commit

Permalink
Merge branch 'field-validation' into deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffersonBledsoe committed Jan 30, 2024
2 parents efbf657 + d54879d commit 57f41a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,15 @@ def _process_data(
self,
data,
):
self._update_validations(data)
return data

def _update_validations(self, data):
for field in data.get("subblocks"):
if field.get("field_type") not in ["text", "textarea", "from"]:
field["validations"] = []
field["validationSettings"] = {}


@implementer(IBlockFieldDeserializationTransformer)
@adapter(IBlocks, IBrowserRequest)
Expand Down
4 changes: 4 additions & 0 deletions src/collective/volto/formsupport/validation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
"_internal_type",
]

VALIDATIONS_TO_IGNORE = ["inNumericRange"]


class IFieldValidator(Interface):
"""Base marker for collective.volto.formsupport field validators."""
Expand All @@ -39,6 +41,8 @@ def _update_validators():

if baseValidators:
for validator in baseValidators:
if validator.name in VALIDATIONS_TO_IGNORE:
continue
provideUtility(
ValidationDefinition(validator),
provides=IFieldValidator,
Expand Down

0 comments on commit 57f41a0

Please sign in to comment.