Changeset View
Changeset View
Standalone View
Standalone View
swh/web/common/service.py
Show First 20 Lines • Show All 305 Lines • ▼ Show 20 Lines | def lookup_origin_intrinsic_metadata(origin_dict): | ||||
match = _first_element( | match = _first_element( | ||||
idx_storage.origin_intrinsic_metadata_get(origins)) | idx_storage.origin_intrinsic_metadata_get(origins)) | ||||
result = {} | result = {} | ||||
if match: | if match: | ||||
result = match['metadata'] | result = match['metadata'] | ||||
return result | return result | ||||
def lookup_person(person_id): | |||||
"""Return information about the person with id person_id. | |||||
Args: | |||||
person_id as string | |||||
Returns: | |||||
person information as dict. | |||||
Raises: | |||||
NotFoundExc if there is no person with the provided id. | |||||
""" | |||||
person = _first_element(storage.person_get([int(person_id)])) | |||||
if not person: | |||||
raise NotFoundExc('Person with id %s not found' % person_id) | |||||
return converters.from_person(person) | |||||
def _to_sha1_bin(sha1_hex): | def _to_sha1_bin(sha1_hex): | ||||
_, sha1_git_bin = query.parse_hash_with_algorithms_or_throws( | _, sha1_git_bin = query.parse_hash_with_algorithms_or_throws( | ||||
sha1_hex, | sha1_hex, | ||||
['sha1'], # HACK: sha1_git really | ['sha1'], # HACK: sha1_git really | ||||
'Only sha1_git is supported.') | 'Only sha1_git is supported.') | ||||
return sha1_git_bin | return sha1_git_bin | ||||
▲ Show 20 Lines • Show All 788 Lines • Show Last 20 Lines |