maybe encode only if bytes; also condition now unneeded
This commit is contained in:
parent
52c429cd60
commit
ffdb5a5413
|
|
@ -29,7 +29,7 @@ class PacketCommentPolicy():
|
||||||
elif ("comment" in data):
|
elif ("comment" in data):
|
||||||
comment = data["comment"]
|
comment = data["comment"]
|
||||||
|
|
||||||
if isinstance(comment, str):
|
if isinstance(comment, bytes):
|
||||||
comment = comment.encode('ascii', 'ignore')
|
comment = comment.encode('ascii', 'ignore')
|
||||||
comment = comment.replace('\x00', '')
|
comment = comment.replace('\x00', '')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ class PacketTelemetryRepository(Repository):
|
||||||
newObject.bits = data["telemetry"]["bits"]
|
newObject.bits = data["telemetry"]["bits"]
|
||||||
|
|
||||||
if ("seq" in data["telemetry"]):
|
if ("seq" in data["telemetry"]):
|
||||||
if isinstance(data["telemetry"]["seq"], str) or isinstance(data["telemetry"]["seq"], str):
|
if isinstance(data["telemetry"]["seq"], str):
|
||||||
try:
|
try:
|
||||||
newObject.seq = int(data["telemetry"]["seq"], 10)
|
newObject.seq = int(data["telemetry"]["seq"], 10)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue