mirror of
https://github.com/mbirth/tcl_ota_check.git
synced 2024-11-09 22:06:47 +00:00
Rearrange storing of result object.
This commit is contained in:
parent
1297b31b2e
commit
d2c51e70d5
@ -8,6 +8,7 @@ from defusedxml import ElementTree
|
||||
class TclRequest:
|
||||
def __init__(self):
|
||||
self.uri = ""
|
||||
self.response = None
|
||||
self.result = None
|
||||
self.error = None
|
||||
self.success = False
|
||||
@ -24,7 +25,7 @@ class TclRequest:
|
||||
|
||||
def get_result(self):
|
||||
"""Returns Result object."""
|
||||
return None
|
||||
return self.result
|
||||
|
||||
class CheckRequest(TclRequest):
|
||||
def __init__(self, device: devices.Device):
|
||||
@ -57,7 +58,8 @@ class CheckRequest(TclRequest):
|
||||
404: "No data for requested CUREF/FV combination.",
|
||||
}
|
||||
if http_status == 200:
|
||||
self.result = contents
|
||||
self.response = contents
|
||||
self.result = tclresult.CheckResult(contents)
|
||||
self.success = True
|
||||
return True
|
||||
elif http_status in ok_states:
|
||||
@ -72,11 +74,6 @@ class CheckRequest(TclRequest):
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_result(self):
|
||||
if not self.success:
|
||||
return None
|
||||
return tclresult.CheckResult(self.result)
|
||||
|
||||
# Check requests have 4 possible outcomes:
|
||||
# 1. HTTP 200 with XML data - our desired info
|
||||
# 2. HTTP 204 - means: no newer update available
|
||||
|
Loading…
Reference in New Issue
Block a user