From 01ceeb1be199e768d571d69b850a0e943b17ef00 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 24 Mar 2022 13:30:53 +0100 Subject: [PATCH] links parsing with snapshot view --- ereuse_devicehub/parser/parser.py | 2 +- ereuse_devicehub/resources/action/views/snapshot.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ereuse_devicehub/parser/parser.py b/ereuse_devicehub/parser/parser.py index e1683bda..b6f8f716 100644 --- a/ereuse_devicehub/parser/parser.py +++ b/ereuse_devicehub/parser/parser.py @@ -24,7 +24,7 @@ class ParseSnapshot: self.hwinfo = self.parse_hwinfo() self.set_basic_datas() - self.computer = { + self.snapshot_json = { "device": self.device, "software": "Workbench", "components": self.components(), diff --git a/ereuse_devicehub/resources/action/views/snapshot.py b/ereuse_devicehub/resources/action/views/snapshot.py index de9564ba..e07421ab 100644 --- a/ereuse_devicehub/resources/action/views/snapshot.py +++ b/ereuse_devicehub/resources/action/views/snapshot.py @@ -11,6 +11,7 @@ from flask.json import jsonify from sqlalchemy.util import OrderedSet from ereuse_devicehub.db import db +from ereuse_devicehub.parser.parser import ParseSnapshot from ereuse_devicehub.resources.action.models import RateComputer, Snapshot from ereuse_devicehub.resources.action.rate.v1_0 import CannotRate from ereuse_devicehub.resources.action.schemas import Snapshot2 @@ -161,6 +162,6 @@ class SnapshotView: self.snapshot_json = self.schema2.load(snapshot_json) def build2(self): - res = jsonify("Ok") - res.status_code = 201 - return res + snap = ParseSnapshot(self.snapshot_json) + self.snapshot_json = snap.snapshot_json + return self.build()