@@ -73,29 +73,11 @@ def validate_keywords(cls, v):
7373 keywords .validate_keywords (v )
7474 return v
7575
76- @validator ("title" )
77- def validate_title (cls , v ):
76+ @validator ("title" , "short_description" , "abstract_text" , "method_text" )
77+ def validate_field_is_non_empty (cls , v , field ):
7878 if is_null (v ) or not isinstance (v , str ):
79- raise ValidationError ("Invalid title. Title should not be None or space." )
80- return v
81-
82- @validator ("short_description" )
83- def validate_short_description (cls , v ):
84- if is_null (v ) or not isinstance (v , str ):
85- raise ValidationError ("Invalid short description. Short description should not be None or space." )
86- return v
87-
88- @validator ("abstract_text" )
89- def validate_abstract_text (cls , v ):
90- if is_null (v ) or not isinstance (v , str ):
91- raise ValidationError ("Invalid abstract text. Abstract text should not be None or space." )
92- return v
93-
94- @validator ("method_text" )
95- def validate_method_text (cls , v ):
96- if is_null (v ) or not isinstance (v , str ):
97- raise ValidationError ("Invalid method text. Method text should not be None or space." )
98- return v
79+ raise ValidationError ("This field is required and cannot be empty." )
80+ return v .strip ()
9981
10082
10183class ExperimentCreate (ExperimentModify ):
0 commit comments