Merge branch 'main' into CURA-11650-thumnails-missing

This commit is contained in:
Saumya Jain 2024-03-08 13:59:40 +01:00 committed by GitHub
commit 02fd7546a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,6 +2,8 @@
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
from typing import Optional, List from typing import Optional, List
import uuid
from .CloudClusterResponse import CloudClusterResponse from .CloudClusterResponse import CloudClusterResponse
from .ClusterPrinterStatus import ClusterPrinterStatus from .ClusterPrinterStatus import ClusterPrinterStatus
@ -11,4 +13,20 @@ class CloudClusterWithConfigResponse(CloudClusterResponse):
def __init__(self, **kwargs) -> None: def __init__(self, **kwargs) -> None:
self.configuration = self.parseModel(ClusterPrinterStatus, kwargs.get("host_printer")) self.configuration = self.parseModel(ClusterPrinterStatus, kwargs.get("host_printer"))
# Some printers will return a null UUID in the host_printer.uuid field. For those we can fall back using
# the host_guid field of the cluster data
valid_uuid = False
try:
parsed_uuid = uuid.UUID(self.configuration.uuid)
valid_uuid = parsed_uuid.int != 0
except:
pass
if not valid_uuid:
try:
self.configuration.uuid = kwargs.get("host_guid")
except:
pass
super().__init__(**kwargs) super().__init__(**kwargs)