Added custom validation to PydSubmission to replace 'finalize_parse'

This commit is contained in:
lwark
2024-09-27 11:12:20 -05:00
parent 9b08fc5186
commit c0f78390b5
3 changed files with 45 additions and 30 deletions

View File

@@ -637,12 +637,16 @@ class PydSubmission(BaseModel, extra='allow'):
else:
return value
def __init__(self, **data):
def __init__(self, run_custom:bool=False, **data):
super().__init__(**data)
# this could also be done with default_factory
# NOTE: this could also be done with default_factory
logger.debug(data)
self.submission_object = BasicSubmission.find_polymorphic_subclass(
polymorphic_identity=self.submission_type['value'])
self.namer = RSLNamer(self.rsl_plate_num['value'], sub_type=self.submission_type['value'])
if run_custom:
self.submission_object.custom_validation(pyd=self)
def set_attribute(self, key: str, value):
"""