Value Errors should also alert us that we can't serialize the json.

Enum Label was depending on the options attribute not existing in some situtations, which is a bad assumption.  Rather, check for specific properties, and call back to using options as the default.
This commit is contained in:
Dan 2021-11-22 12:37:10 -05:00
parent 4d1f4429ff
commit 12b78c1f99
3 changed files with 3 additions and 55189 deletions

File diff suppressed because it is too large Load Diff

View File

@ -82,7 +82,7 @@ class ApiError(Exception):
try: try:
json.dumps(x) json.dumps(x)
return True return True
except (TypeError, OverflowError): except (TypeError, OverflowError, ValueError):
return False return False
@classmethod @classmethod

View File

@ -39,10 +39,10 @@ pet_label = enum_label(task='task_pet_form',field='pet',value='1') // might r
return self.lookup_label(workflow_model, task_name, field, value) return self.lookup_label(workflow_model, task_name, field, value)
elif field.has_property(Task.FIELD_PROP_SPREADSHEET_NAME): elif field.has_property(Task.FIELD_PROP_SPREADSHEET_NAME):
return self.lookup_label(workflow_model, task_name, field, value) return self.lookup_label(workflow_model, task_name, field, value)
elif field.type == Task.FIELD_TYPE_ENUM and hasattr(field, 'options'):
return self.enum_with_options_label(field, value)
elif field.has_property(Task.FIELD_PROP_DATA_NAME): elif field.has_property(Task.FIELD_PROP_DATA_NAME):
return self.enum_from_task_data_label(spiff_task, field, value) return self.enum_from_task_data_label(spiff_task, field, value)
else:
return self.enum_with_options_label(field, value)
def find_field(self, task_name, field_name, workflow): def find_field(self, task_name, field_name, workflow):
for spec in workflow.spec.task_specs.values(): for spec in workflow.spec.task_specs.values():