From a85c113ee7aeaf7348de83fe3aa4dcd9d525a8bf Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Wed, 26 Feb 2020 17:57:58 +0100 Subject: Rename operation to method As defined by the HTTP standard. --- src/ogClient.py | 2 +- src/ogRest.py | 8 ++++---- src/restRequest.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ogClient.py b/src/ogClient.py index 9ad38ff..5c7706c 100644 --- a/src/ogClient.py +++ b/src/ogClient.py @@ -98,7 +98,7 @@ class ogClient: if self.trailer and len(self.data) >= self.content_len: request.parser(self.data) - self.ogrest.processOperation(request, self) + self.ogrest.process_request(request, self) # Cleanup state information from request self.data = "" diff --git a/src/ogRest.py b/src/ogRest.py index f6b8ca4..c68eb0e 100644 --- a/src/ogRest.py +++ b/src/ogRest.py @@ -236,8 +236,8 @@ class ogRest(): self.terminated = False self.state = ThreadState.IDLE - def processOperation(self, request, client): - op = request.getRequestOP() + def process_request(self, request, client): + method = request.get_method() URI = request.getURI() if (not "stop" in URI and @@ -251,7 +251,7 @@ class ogRest(): else: self.state = ThreadState.BUSY - if ("GET" in op): + if ("GET" in method): if "hardware" in URI: self.process_hardware(client) elif ("run/schedule" in URI): @@ -261,7 +261,7 @@ class ogRest(): else: response = restResponse(ogResponses.BAD_REQUEST) client.send(response.get()) - elif ("POST" in op): + elif ("POST" in method): if ("poweroff" in URI): self.process_poweroff(client) elif "probe" in URI: diff --git a/src/restRequest.py b/src/restRequest.py index 6ed00c4..b0baa15 100644 --- a/src/restRequest.py +++ b/src/restRequest.py @@ -48,7 +48,7 @@ class restRequest: self.contentLen = int(self.headers['Content-Length']) if (not self.requestLine == None or not self.requestLine == ''): - self.operation = self.requestLine.split('/', 1)[0] + self.method = self.requestLine.split('/', 1)[0] self.URI = self.requestLine.split('/', 1)[1] if not self.contentLen == 0: @@ -100,8 +100,8 @@ class restRequest: if "code" in json_param: self.code = json_param["code"] - def getRequestOP(self): - return self.operation + def get_method(self): + return self.method def getURI(self): return self.URI -- cgit v1.2.3-18-g5258