MCPcopy Index your code
hub / github.com/dataease/SQLBot / validate_row

Function validate_row

backend/apps/system/crud/user_excel.py:159–173  ·  view source on GitHub ↗
(trans, head_i18n_list: list[str], row)

Source from the content-addressed store, hash-verified

157
158
159def validate_row(trans, head_i18n_list: list[str], row):
160 validator = RowValidator(success=True, row=[], error_info={})
161 for i in range(len(head_i18n_list)):
162 col_name = trans(head_i18n_list[i])
163 row_value = getattr(row, col_name)
164 validator.row.append(row_value)
165 _attr_name = f"{head_i18n_list[i].split('.')[-1]}"
166 _method_name = f"validate_{_attr_name}"
167 cellValidator = dynamic_call(_method_name, row_value)
168 if not cellValidator.success:
169 validator.success = False
170 validator.error_info[i] = cellValidator.message
171 else:
172 validator.dict_data[_attr_name] = cellValidator.value
173 return validator
174
175def generate_error_file(error_list: list[RowValidator], head_list: list[str]) -> str:
176 # If no errors, return empty string

Callers 1

batchUploadFunction · 0.85

Calls 3

RowValidatorClass · 0.85
dynamic_callFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected