From 9aebc1737ab4baf1140ad975ed07544b13545ccb Mon Sep 17 00:00:00 2001 From: ajul Date: Sat, 27 Jan 2018 21:16:57 -0500 Subject: [PATCH] fix default column_specs --- pyradox/filetype/table.py | 5 +++-- tests/csv_test.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pyradox/filetype/table.py b/pyradox/filetype/table.py index 8e03ab0..6827528 100644 --- a/pyradox/filetype/table.py +++ b/pyradox/filetype/table.py @@ -1,3 +1,4 @@ +import pyradox.format import re class Dialect: @@ -92,7 +93,7 @@ def guess_is_numeric(s): def default_column_specs(key, row): column_specs = [('id', None)] - for k, v in row: + for k, v in row.items(): column_specs.append((k, '%%(%s)s' % k)) return column_specs @@ -149,7 +150,7 @@ def apply_format_spec(key, row, format_spec): except ZeroDivisionError: return '' elif format_spec is None: - return human_string(key, True) + return pyradox.format.human_string(key, True) else: try: return format_spec % row diff --git a/tests/csv_test.py b/tests/csv_test.py index a2ccd64..eda8922 100644 --- a/tests/csv_test.py +++ b/tests/csv_test.py @@ -1,5 +1,6 @@ import _initpath import pyradox.filetype.csv +import pyradox.filetype.table spec = ( ('Name', '%(name)s'), @@ -8,5 +9,5 @@ ) for filename, tree in pyradox.filetype.csv.parse_dir('C:/Program Files (x86)/Steam/steamapps/common/Hearts of Iron 2 Complete Pack/Doomsday/db/tech/teams'): - print(filename, tree) + print(pyradox.filetype.table.make_table(tree, 'wiki'))