Skip to content

Commit

Permalink
Merge pull request CLARIAH#334 from c-martinez/licenseOptional
Browse files Browse the repository at this point in the history
Add extra check for missing license
  • Loading branch information
albertmeronyo authored May 5, 2021
2 parents 15c7c06 + 78a2aff commit d82f9f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/fileLoaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def getRepoURI(self):

def getLicenceURL(self):
"""Returns the URL of the license file in the specification."""
return self.spec['licence'] if self.spec['licence'] else ''
return self.spec['licence'] if 'licence' in self.spec else None

def getEndpointText(self):
"""Return content of endpoint file (endpoint.txt)"""
Expand Down
9 changes: 5 additions & 4 deletions src/swagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_repo_info(loader, sha, prov_g):
contact_name = loader.getContactName()
contact_url = loader.getContactUrl()
commit_list = loader.getCommitList()
licence_url = loader.getLicenceURL()
licence_url = loader.getLicenceURL() # This will be None if there is no license

# Add the API URI as a used entity by the activity
if prov_g:
Expand All @@ -50,12 +50,13 @@ def get_repo_info(loader, sha, prov_g):
'contact': {
'name': contact_name,
'url': contact_url
},
'license': {
}
}
if licence_url:
info['license'] = {
'name': 'License',
'url': licence_url
}
}

if type(loader) is GithubLoader:
basePath = '/api-git/' + user_repo + '/'
Expand Down

0 comments on commit d82f9f5

Please sign in to comment.