Changeset View
Changeset View
Standalone View
Standalone View
swh/web/common/archive.py
Show First 20 Lines • Show All 180 Lines • ▼ Show 20 Lines | if not sha1: | ||||
return None | return None | ||||
filetype = _first_element(list(idx_storage.content_mimetype_get([sha1]))) | filetype = _first_element(list(idx_storage.content_mimetype_get([sha1]))) | ||||
if not filetype: | if not filetype: | ||||
return None | return None | ||||
return converters.from_filetype(filetype.to_dict()) | return converters.from_filetype(filetype.to_dict()) | ||||
def lookup_content_language(q): | def lookup_content_language(q): | ||||
"""Return language information from a specified content. | """Always returns None. | ||||
This used to return language information from a specified content, | |||||
but this is currently disabled. | |||||
Args: | Args: | ||||
q: query string of the form <hash_algo:hash> | q: query string of the form <hash_algo:hash> | ||||
Yields: | Yields: | ||||
language information (dict) list if the content is found. | language information (dict) list if the content is found. | ||||
""" | """ | ||||
sha1 = _lookup_content_sha1(q) | |||||
if not sha1: | |||||
return None | |||||
lang = _first_element(list(idx_storage.content_language_get([sha1]))) | |||||
if not lang: | |||||
return None | return None | ||||
return converters.from_swh(lang, hashess={"id"}) | |||||
def lookup_content_license(q): | def lookup_content_license(q): | ||||
"""Return license information from a specified content. | """Return license information from a specified content. | ||||
Args: | Args: | ||||
q: query string of the form <hash_algo:hash> | q: query string of the form <hash_algo:hash> | ||||
▲ Show 20 Lines • Show All 1,146 Lines • Show Last 20 Lines |