diff --git a/ereuse_devicehub/resources/device/models.py b/ereuse_devicehub/resources/device/models.py index 0703359d..56fd6de9 100644 --- a/ereuse_devicehub/resources/device/models.py +++ b/ereuse_devicehub/resources/device/models.py @@ -1076,13 +1076,13 @@ class Mobile(Device): @validates('imei') def validate_imei(self, _, value: int): - if not imei.is_valid(str(value)): + if value and not imei.is_valid(str(value)): raise ValidationError('{} is not a valid imei.'.format(value)) return value @validates('meid') def validate_meid(self, _, value: str): - if not meid.is_valid(value): + if value and not meid.is_valid(value): raise ValidationError('{} is not a valid meid.'.format(value)) return value diff --git a/ereuse_devicehub/resources/device/schemas.py b/ereuse_devicehub/resources/device/schemas.py index f1e22d51..2cc8e65d 100644 --- a/ereuse_devicehub/resources/device/schemas.py +++ b/ereuse_devicehub/resources/device/schemas.py @@ -291,8 +291,7 @@ class Mobile(Device): @pre_load def convert_check_imei(self, data): if data.get('imei', None): - # data['imei'] = int(imei.validate(data['imei'])) - data['imei'] = int(data['imei']) + data['imei'] = int(imei.validate(data['imei'])) return data @pre_load