-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
def format_fields(self, fields):
The fields object passed as an argument is modified within the function, which can lead to issues if the function is called multiple times, as it may result in broken or unintended data.
For example, in the following snippet:
if self.block["subblocks"][field_index].get("field_type") == "date":
field["value"] = api.portal.get_localized_time(field["value"])
It seems get_localized_time expects a datetime object or an ISO-formatted string, not a localized string.
A quick fix to avoid mutating the original fields object is to add a deepcopy at the start of the function:
def format_fields(self, fields):
fields = deepcopy(fields)
@JeffersonBledsoe thoughts ?
see #34
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels