Skip to content

Commit

Permalink
views: Run the conversion twice, to pick up the correct schema version
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjwebb committed Aug 18, 2020
1 parent e96a01a commit 01e4805
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cove_bods/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ def explore_bods(request, pk):
schema_url=schema_bods.release_pkg_schema_url))
with open(context['converted_path'], encoding='utf-8') as fp:
json_data = json.load(fp, parse_float=Decimal)
# Create schema_bods again now that we have json_data (this will pick
# up the appropriate schema)
schema_bods = SchemaBODS(json_data=json_data, lib_cove_bods_config=lib_cove_bods_config)
# Run the conversion again now that we have the correct schema
context.update(convert_spreadsheet(upload_dir, upload_url, file_name, file_type, lib_cove_bods_config,
schema_url=schema_bods.release_pkg_schema_url,
cache=False, replace=True))
with open(context['converted_path'], encoding='utf-8') as fp:
json_data = json.load(fp, parse_float=Decimal)

context = common_checks_bods(context, upload_dir, json_data, schema_bods,
lib_cove_bods_config=lib_cove_bods_config)
Expand Down

0 comments on commit 01e4805

Please sign in to comment.