Fixed KeyError in events.py that prevented a command associated with the ClientOpened event from execution.

The if-statement checked against currentData["job"] is not None, although it was not None even if there was no job.
This commit is contained in:
clemniem authored and Gina Häußge committed 2016-09-16 16:21:28 +02:00
1 parent 650e1971d4
commit 74fd5e8956
2 files changed
+3 -1

No files matched your search

+1
View File
@@ -72,6 +72,7 @@ date of first contribution):
* [Ovidiu Hossu](https://github.com/MoonshineSG)
* [Eyck Jentzsch](https://github.com/eyck)
* [Mathias Rangel Wulff](https://github.com/mathiasrw)
* [Clemens Niemeyer](https://github.com/clemniem)
OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by
[Daid Braam](https://github.com/daid). Parts of its communication layer and
+2 -1
View File
@@ -386,7 +386,8 @@ class CommandTrigger(GenericEventListener):
if "currentZ" in currentData.keys() and currentData["currentZ"] is not None:
params["__currentZ"] = str(currentData["currentZ"])
if "job" in currentData.keys() and currentData["job"] is not None:
if "job" in currentData and "file" in currentData["job"] and "name" in currentData["job"]["file"] \
and currentData["job"]["file"]["name"] is not None:
params["__filename"] = currentData["job"]["file"]["name"]
params["__filepath"] = currentData["job"]["file"]["path"]
params["__fileorigin"] = currentData["job"]["file"]["origin"]