From 4cfc74c344628e37956c5c04246325b914450fe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 19 Oct 2015 13:23:47 +0200 Subject: [PATCH] Fix: Each divider action needs a custom action id Closes #1084 --- src/octoprint/server/api/system.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/octoprint/server/api/system.py b/src/octoprint/server/api/system.py index fba71f43..76bc95a8 100644 --- a/src/octoprint/server/api/system.py +++ b/src/octoprint/server/api/system.py @@ -62,6 +62,9 @@ def retrieveSystemCommandsForSource(source): def executeSystemCommand(source, command): logger = logging.getLogger(__name__) + if command == "divider": + return make_response("Dividers cannot be executed", 400) + command_spec = _get_command_spec(source, command) if not command_spec: return make_response("Command {}:{} not found".format(source, command), 404) @@ -158,12 +161,18 @@ def _get_core_command_spec(action): def _get_custom_command_specs(): specs = collections.OrderedDict() + dividers = 0 for spec in s().get(["system", "actions"]): if not "action" in spec: continue copied = dict(spec) copied["source"] = "custom" - specs[spec["action"]] = copied + + action = spec["action"] + if action == "divider": + dividers += 1 + action = "divider_{}".format(dividers) + specs[action] = copied return specs