Changeset View
Changeset View
Standalone View
Standalone View
swh/web/common/service.py
Show First 20 Lines • Show All 209 Lines • ▼ Show 20 Lines | def lookup_content_license(q): | ||||
Yields: | Yields: | ||||
license information (dict) list if the content is found. | license information (dict) list if the content is found. | ||||
""" | """ | ||||
sha1 = _lookup_content_sha1(q) | sha1 = _lookup_content_sha1(q) | ||||
if not sha1: | if not sha1: | ||||
return None | return None | ||||
lang = _first_element(idx_storage.content_fossology_license_get([sha1])) | lic = _first_element(idx_storage.content_fossology_license_get([sha1])) | ||||
if not lang: | |||||
if not lic: | |||||
return None | return None | ||||
return converters.from_swh(lang, hashess={'id'}) | return converters.from_swh({'id': sha1, 'facts': lic[sha1]}, | ||||
hashess={'id'}) | |||||
def lookup_origin(origin): | def lookup_origin(origin): | ||||
"""Return information about the origin matching dict origin. | """Return information about the origin matching dict origin. | ||||
Args: | Args: | ||||
origin: origin's dict with keys either 'id' or | origin: origin's dict with keys either 'id' or | ||||
('type' AND 'url') | ('type' AND 'url') | ||||
▲ Show 20 Lines • Show All 713 Lines • Show Last 20 Lines |