remove validate of imei
This commit is contained in:
parent
2c171d8e26
commit
2ef6e6cb49
|
@ -34,7 +34,7 @@ from sqlalchemy.ext.hybrid import hybrid_property
|
||||||
from sqlalchemy.orm import ColumnProperty, backref, relationship, validates
|
from sqlalchemy.orm import ColumnProperty, backref, relationship, validates
|
||||||
from sqlalchemy.util import OrderedSet
|
from sqlalchemy.util import OrderedSet
|
||||||
from sqlalchemy_utils import ColorType
|
from sqlalchemy_utils import ColorType
|
||||||
from stdnum import imei, meid
|
from stdnum import meid
|
||||||
|
|
||||||
from ereuse_devicehub.db import db
|
from ereuse_devicehub.db import db
|
||||||
from ereuse_devicehub.ereuse_utils.naming import HID_CONVERSION_DOC
|
from ereuse_devicehub.ereuse_utils.naming import HID_CONVERSION_DOC
|
||||||
|
@ -1478,11 +1478,11 @@ class Mobile(Device):
|
||||||
)
|
)
|
||||||
display_size.comment = """The total size of the device screen"""
|
display_size.comment = """The total size of the device screen"""
|
||||||
|
|
||||||
@validates('imei')
|
# @validates('imei')
|
||||||
def validate_imei(self, _, value: int):
|
# def validate_imei(self, _, value: int):
|
||||||
if value and not imei.is_valid(str(value)):
|
# if value and not imei.is_valid(str(value)):
|
||||||
raise ValidationError('{} is not a valid imei.'.format(value))
|
# raise ValidationError('{} is not a valid imei.'.format(value))
|
||||||
return value
|
# return value
|
||||||
|
|
||||||
@validates('meid')
|
@validates('meid')
|
||||||
def validate_meid(self, _, value: str):
|
def validate_meid(self, _, value: str):
|
||||||
|
|
|
@ -16,7 +16,7 @@ from marshmallow.fields import (
|
||||||
)
|
)
|
||||||
from marshmallow.validate import Length, OneOf, Range
|
from marshmallow.validate import Length, OneOf, Range
|
||||||
from sqlalchemy.util import OrderedSet
|
from sqlalchemy.util import OrderedSet
|
||||||
from stdnum import imei, meid
|
from stdnum import meid
|
||||||
|
|
||||||
from ereuse_devicehub.marshmallow import NestedOn
|
from ereuse_devicehub.marshmallow import NestedOn
|
||||||
from ereuse_devicehub.resources import enums
|
from ereuse_devicehub.resources import enums
|
||||||
|
@ -301,11 +301,11 @@ class Mobile(Device):
|
||||||
description=m.Mobile.display_size.comment,
|
description=m.Mobile.display_size.comment,
|
||||||
)
|
)
|
||||||
|
|
||||||
@pre_load
|
# @pre_load
|
||||||
def convert_check_imei(self, data):
|
# def convert_check_imei(self, data):
|
||||||
if data.get('imei', None):
|
# if data.get('imei', None):
|
||||||
data['imei'] = int(imei.validate(data['imei']))
|
# data['imei'] = int(imei.validate(data['imei']))
|
||||||
return data
|
# return data
|
||||||
|
|
||||||
@pre_load
|
@pre_load
|
||||||
def convert_check_meid(self, data: dict):
|
def convert_check_meid(self, data: dict):
|
||||||
|
|
|
@ -264,6 +264,7 @@ class BaseDeviceRow(OrderedDict):
|
||||||
self['Data Storage Rate'] = ''
|
self['Data Storage Rate'] = ''
|
||||||
self['Data Storage Range'] = ''
|
self['Data Storage Range'] = ''
|
||||||
self['Benchmark RamSysbench (points)'] = ''
|
self['Benchmark RamSysbench (points)'] = ''
|
||||||
|
self['IMEI'] = ''
|
||||||
|
|
||||||
|
|
||||||
class DeviceRow(BaseDeviceRow):
|
class DeviceRow(BaseDeviceRow):
|
||||||
|
@ -340,6 +341,9 @@ class DeviceRow(BaseDeviceRow):
|
||||||
|
|
||||||
self.get_placeholder_datas()
|
self.get_placeholder_datas()
|
||||||
|
|
||||||
|
if isinstance(device, d.Mobile):
|
||||||
|
self['IMEI'] = device.imei or ''
|
||||||
|
|
||||||
def components(self):
|
def components(self):
|
||||||
"""Function to get all components information of a device."""
|
"""Function to get all components information of a device."""
|
||||||
assert isinstance(self.device, d.Computer)
|
assert isinstance(self.device, d.Computer)
|
||||||
|
|
Reference in New Issue