File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,11 @@ class Meta:
26
26
27
27
@validates_schema
28
28
def validate_length (self , data ):
29
+ if 'length' not in data :
30
+ raise UnprocessableEntityError (
31
+ {'pointer' : '/data/attributes/length' },
32
+ "Length attribute is missing" ,
33
+ )
29
34
try :
30
35
datetime .strptime (data ['length' ], '%H:%M' )
31
36
except ValueError :
Original file line number Diff line number Diff line change @@ -26,6 +26,11 @@ class Meta:
26
26
27
27
@validates_schema
28
28
def valid_color (self , data ):
29
+ if 'color' not in data :
30
+ raise UnprocessableEntityError (
31
+ {'pointer' : '/data/attributes/color' },
32
+ "Color attribut is required" ,
33
+ )
29
34
if not re .search (r'^#(?:[0-9a-fA-F]{3}){1,2}$' , data ['color' ]):
30
35
raise UnprocessableEntityError (
31
36
{'pointer' : 'data/attributes/color' },
You can’t perform that action at this time.
0 commit comments