fix new hid in build
This commit is contained in:
parent
4b13995b4f
commit
d6bee33601
|
@ -318,8 +318,6 @@ class UploadSnapshotForm(SnapshotMixin, FlaskForm):
|
||||||
try:
|
try:
|
||||||
snapshot_json = schema.load(snapshot_json)
|
snapshot_json = schema.load(snapshot_json)
|
||||||
response = self.build(snapshot_json)
|
response = self.build(snapshot_json)
|
||||||
response.device.set_hid()
|
|
||||||
response.device.binding.device.set_hid()
|
|
||||||
except ValidationError as err:
|
except ValidationError as err:
|
||||||
txt = "{}".format(err)
|
txt = "{}".format(err)
|
||||||
self.errors(txt=txt)
|
self.errors(txt=txt)
|
||||||
|
|
|
@ -8,6 +8,7 @@ from uuid import UUID
|
||||||
|
|
||||||
from flask import current_app as app
|
from flask import current_app as app
|
||||||
from flask import g
|
from flask import g
|
||||||
|
from marshmallow import ValidationError
|
||||||
from sqlalchemy.util import OrderedSet
|
from sqlalchemy.util import OrderedSet
|
||||||
|
|
||||||
from ereuse_devicehub.db import db
|
from ereuse_devicehub.db import db
|
||||||
|
@ -115,6 +116,13 @@ class SnapshotMixin:
|
||||||
|
|
||||||
self.is_server_erase(snapshot)
|
self.is_server_erase(snapshot)
|
||||||
|
|
||||||
|
snapshot.device.set_hid()
|
||||||
|
snapshot.device.binding.device.set_hid()
|
||||||
|
if not snapshot.device.hid:
|
||||||
|
txt = "Not exist the basic fields for to do an device. "
|
||||||
|
txt += "Please do one placeholder instead of one snapshot"
|
||||||
|
raise ValidationError(txt)
|
||||||
|
|
||||||
return snapshot
|
return snapshot
|
||||||
|
|
||||||
def is_server_erase(self, snapshot):
|
def is_server_erase(self, snapshot):
|
||||||
|
@ -219,8 +227,6 @@ class SnapshotView(SnapshotMixin):
|
||||||
try:
|
try:
|
||||||
self.snapshot_json = resource_def.schema.load(snapshot_json)
|
self.snapshot_json = resource_def.schema.load(snapshot_json)
|
||||||
snapshot = self.build()
|
snapshot = self.build()
|
||||||
snapshot.device.set_hid()
|
|
||||||
snapshot.device.binding.device.set_hid()
|
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
txt = "{}".format(err)
|
txt = "{}".format(err)
|
||||||
self.errors(txt=txt, commit=True)
|
self.errors(txt=txt, commit=True)
|
||||||
|
|
|
@ -772,6 +772,8 @@ class Device(Thing):
|
||||||
system_uuid = ''
|
system_uuid = ''
|
||||||
if hasattr(self, 'system_uuid'):
|
if hasattr(self, 'system_uuid'):
|
||||||
system_uuid = str(self.system_uuid or '')
|
system_uuid = str(self.system_uuid or '')
|
||||||
|
if not system_uuid or not self.manufacturer:
|
||||||
|
return ''
|
||||||
|
|
||||||
board = None
|
board = None
|
||||||
board_serial_number = ''
|
board_serial_number = ''
|
||||||
|
|
Reference in a new issue