From 870cabfa0548004ba1737aec67a6cea91395890c Mon Sep 17 00:00:00 2001 From: Arksine Date: Mon, 9 Nov 2020 07:01:04 -0500 Subject: [PATCH] data_store: update request handlers to accept WebRequest objects Signed-off-by: Eric Callahan --- moonraker/plugins/data_store.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/moonraker/plugins/data_store.py b/moonraker/plugins/data_store.py index 8f8858b..77760a7 100644 --- a/moonraker/plugins/data_store.py +++ b/moonraker/plugins/data_store.py @@ -98,7 +98,7 @@ class DataStore: self.temperature_store[sensor]['temperatures'].append(temp) self.temperature_store[sensor]['targets'].append(target) - async def _handle_temp_store_request(self, path, method, args): + async def _handle_temp_store_request(self, web_request): store = {} for name, sensor in self.temperature_store.items(): store[name] = {k: list(v) for k, v in sensor.items()} @@ -111,15 +111,9 @@ class DataStore: curtime = time.time() self.gcode_queue.append({'message': response, 'time': curtime}) - async def _handle_gcode_store_request(self, path, method, args): - count = args.get("count", None) + async def _handle_gcode_store_request(self, web_request): + count = web_request.get_int("count", None) if count is not None: - try: - count = int(count) - except Exception: - raise self.server.error( - "Parameter must be an integer value, " - f"received: {count}") res = list(self.gcode_queue)[-count:] else: res = list(self.gcode_queue)