Skip to content

Commit

Permalink
Merge pull request #731 from HEPData/fix-converter-url
Browse files Browse the repository at this point in the history
converter: get `CFG_CONVERTER_URL` from `current_app`
  • Loading branch information
GraemeWatt authored Nov 15, 2023
2 parents c7415f5 + bdedae4 commit 28d52b8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions hepdata/modules/converter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def convert_zip_archive(input_archive, output_archive, options):
input_directory, input_file = validation

successful = convert(
CFG_CONVERTER_URL,
current_app.config.get('CFG_CONVERTER_URL', CFG_CONVERTER_URL),
input_directory if input == 'yaml' else input_file,
output=output_archive,
options=options,
Expand Down Expand Up @@ -84,7 +84,7 @@ def convert_oldhepdata_to_yaml(input_path, output_path):
'output_format': 'yaml',
}
successful = convert(
CFG_CONVERTER_URL,
current_app.config.get('CFG_CONVERTER_URL', CFG_CONVERTER_URL),
input_path,
output=output_path,
options=options,
Expand Down
2 changes: 1 addition & 1 deletion hepdata/modules/converter/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def download_datatable(datasubmission, file_format, *args, **kwargs):

try:
successful = convert(
CFG_CONVERTER_URL,
current_app.config.get('CFG_CONVERTER_URL', CFG_CONVERTER_URL),
record_path,
output=output_path + '-dir',
options=options,
Expand Down
2 changes: 1 addition & 1 deletion hepdata/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
and parsed by ``setup.py``.
"""

__version__ = "0.9.4dev20231114"
__version__ = "0.9.4dev20231115"
2 changes: 1 addition & 1 deletion tests/converter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_convert_and_store_valid_yaml(app, capsys, load_submission):
base_dir = os.path.dirname(os.path.realpath(__file__))
test_tar_gz_file = os.path.join(base_dir, 'test_data', '1396331.tar.gz')
with open(test_tar_gz_file, "rb") as stream:
responses.add(responses.GET, CFG_CONVERTER_URL + '/convert',
responses.add(responses.GET, app.config.get('CFG_CONVERTER_URL', CFG_CONVERTER_URL) + '/convert',
status=200, headers={'mimetype': 'application/x-gzip'},
body=stream.read(), stream=True)

Expand Down

0 comments on commit 28d52b8

Please sign in to comment.