Skip to content

Commit

Permalink
Extend rows that are too short with None
Browse files Browse the repository at this point in the history
  • Loading branch information
bendmorris committed Jan 17, 2017
1 parent 13993aa commit 540a157
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ def values_from_line(self, line):
# too many values for columns; ignore
pass
column += 1

# make sure we have enough values by padding with None
keys = self.get_insert_columns(join=False, create=False)
if len(linevalues) < len(keys):
linevalues.extend([None for _ in range(len(keys) - len(linevalues))])

return linevalues

def get_insert_columns(self, join=True, create=False):
Expand Down

0 comments on commit 540a157

Please sign in to comment.