Skip to content

Commit 769b272

Browse files
committed
Allow RootListPath to be specified in metatab
I *guess* this is right? Order of precedence is: --root-list-path > metatab RootListPath > --default-configuration
1 parent 795644f commit 769b272

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

flattentool/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def decimal_default(o):
111111

112112

113113
def unflatten(input_name, base_json=None, input_format=None, output_name=None,
114-
root_list_path='main', encoding='utf8', timezone_name='UTC',
114+
root_list_path=None, encoding='utf8', timezone_name='UTC',
115115
root_id=None, schema='', convert_titles=False, cell_source_map=None,
116116
heading_source_map=None, id_name='id', xml=False,
117117
vertical_orientation=False,
@@ -179,6 +179,9 @@ def unflatten(input_name, base_json=None, input_format=None, output_name=None,
179179
if result:
180180
base.update(result[0])
181181

182+
if root_list_path is None:
183+
root_list_path = base_configuration.get('RootListPath', 'main')
184+
182185
if not metatab_only:
183186
spreadsheet_input_class = INPUT_FORMATS[input_format]
184187
spreadsheet_input = spreadsheet_input_class(

flattentool/lib.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ def parse_sheet_configuration(configuration_list):
1919
configuration['hashcomments'] = True
2020
if (len(parts) == 2 and parts[0].lower() == "xmlroottag"):
2121
configuration['XMLRootTag'] = parts[1]
22+
if (len(parts) == 2 and parts[0].lower() == "rootlistpath"):
23+
configuration['RootListPath'] = parts[1]
2224
return configuration

0 commit comments

Comments
 (0)