Commit 552ff552 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

raise an error with the spdx_id when we cant find the corresponding License

parent ebc3549f
Pipeline #1534 passed with stages
in 57 seconds
......@@ -930,7 +930,10 @@ def update_github(forge, namespace, data):
repo_data = repo.api_data()
if repo_data and 'license' in repo_data and repo_data['license']:
if 'spdx_id' in repo_data['license'] and repo_data['license']['spdx_id']:
license = License.objects.get(spdx_id=repo_data['license']['spdx_id'])
try:
license = License.objects.get(spdx_id=repo_data['license']['spdx_id'])
except models.DoesNotExist:
raise ValueError('No License with spdx_id=' + repo_data['license']['spdx_id'])
repo.license = license
if not project.license:
project.license = license
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment