Skip to content

Commit

Permalink
Merge pull request #422 from NASA-AMMOS/minor-fixes
Browse files Browse the repository at this point in the history
Minor fixes to issues found in master
  • Loading branch information
nttoole authored Mar 5, 2022
2 parents 347af0f + 0c802ff commit 5b9a247
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion ait/core/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,13 @@ def encode(self, value):
"""Encodes the given value according to this AIT Argument
Definition.
"""
if not self.type:
return bytearray()

if type(value) == str and self.enum and value in self.enum:
value = self.enum[value]
return self.type.encode(value) if self.type else bytearray()
return self.type.encode(*value) if type(value) in [tuple, list] else self.type.encode(value)


def slice(self, offset=0):
"""Returns a Python slice object (e.g. for array indexing) indicating
Expand Down
2 changes: 1 addition & 1 deletion ait/core/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ def insert(self, packet, time=None, **kwargs):
if time \
else (sqlite3.Binary(packet._data))

self._conn.execute(sql, (sqlite3.Binary(packet._data), time))
self._conn.execute(sql, values)
self._conn.commit()

def _query(self, query, **kwargs):
Expand Down

0 comments on commit 5b9a247

Please sign in to comment.