From 31b62a2d81aef5ab751384e9a2ec7be212cf61e0 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 20 Dec 2022 10:17:42 +0100 Subject: [PATCH] check if is active module hid --- ereuse_devicehub/resources/device/models.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ereuse_devicehub/resources/device/models.py b/ereuse_devicehub/resources/device/models.py index e715342e..222f0d54 100644 --- a/ereuse_devicehub/resources/device/models.py +++ b/ereuse_devicehub/resources/device/models.py @@ -9,7 +9,8 @@ from typing import Dict, List, Set from boltons import urlutils from citext import CIText -from ereuse_utils.naming import HID_CONVERSION_DOC, Naming +from ereuse_utils.naming import HID_CONVERSION_DOC +from flask import current_app as app from flask import g, request from more_itertools import unique_everseen from sqlalchemy import BigInteger, Boolean, Column @@ -770,14 +771,15 @@ class Device(Thing): ).first() def set_hid(self): - try: - from modules.device.utils import set_hid + if 'property_hid' not in app.blueprints.keys(): + try: + from modules.device.utils import set_hid - self.hid = set_hid(self) - self.set_chid() - return - except Exception: - pass + self.hid = set_hid(self) + self.set_chid() + return + except Exception: + pass self.hid = "{}-{}-{}-{}".format( self._clean_string(self.type),