Merge branch 'master' into cloud-output-device

This commit is contained in:
ChrisTerBeke 2018-11-27 16:59:28 +01:00
commit 4e150fb4bf
27 changed files with 815 additions and 57 deletions

View file

@ -14,7 +14,7 @@ class BaseModel:
## Class representing a material that was fetched from the cluster API.
class ClusterMaterial(BaseModel):
def __init__(self, guid = str, version = str, **kwargs) -> None:
def __init__(self, guid: str, version: int, **kwargs) -> None:
self.guid = guid # type: str
self.version = version # type: int
super().__init__(**kwargs)
@ -28,7 +28,7 @@ class ClusterMaterial(BaseModel):
## Class representing a local material that was fetched from the container registry.
class LocalMaterial(BaseModel):
def __init__(self, GUID = str, id = str, version = str, **kwargs) -> None:
def __init__(self, GUID: str, id: str, version: int, **kwargs) -> None:
self.GUID = GUID # type: str
self.id = id # type: str
self.version = version # type: int

View file

@ -160,7 +160,9 @@ class SendMaterialJob(Job):
except json.JSONDecodeError:
Logger.log("e", "Request material storage on printer: I didn't understand the printer's answer.")
except ValueError:
Logger.log("e", "Request material storage on printer: Printer's answer was missing a value.")
Logger.log("e", "Request material storage on printer: Printer's answer had an incorrect value.")
except TypeError:
Logger.log("e", "Request material storage on printer: Printer's answer was missing a required value.")
## Retrieves a list of local materials
#
@ -189,5 +191,7 @@ class SendMaterialJob(Job):
Logger.logException("w", "Local material {} has missing values.".format(material["id"]))
except ValueError:
Logger.logException("w", "Local material {} has invalid values.".format(material["id"]))
except TypeError:
Logger.logException("w", "Local material {} has invalid values.".format(material["id"]))
return result