Changeset View
Changeset View
Standalone View
Standalone View
swh/web/api/views/directory.py
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | .. http:get:: /api/1/directory/(sha1_git)/[(path)/] | ||||
:swh_web_api:`directory/977fc4b98c0e85816348cebd3b12026407c368b6/` | :swh_web_api:`directory/977fc4b98c0e85816348cebd3b12026407c368b6/` | ||||
""" # noqa | """ # noqa | ||||
if path: | if path: | ||||
error_msg_path = ('Entry with path %s relative to directory ' | error_msg_path = ('Entry with path %s relative to directory ' | ||||
'with sha1_git %s not found.') % (path, sha1_git) | 'with sha1_git %s not found.') % (path, sha1_git) | ||||
return api_lookup( | return api_lookup( | ||||
service.lookup_directory_with_path, sha1_git, path, | service.lookup_directory_with_path, sha1_git, path, | ||||
notfound_msg=error_msg_path, | notfound_msg=error_msg_path, | ||||
enrich_fn=utils.enrich_directory) | enrich_fn=utils.enrich_directory, | ||||
request=request) | |||||
else: | else: | ||||
error_msg_nopath = 'Directory with sha1_git %s not found.' % sha1_git | error_msg_nopath = 'Directory with sha1_git %s not found.' % sha1_git | ||||
return api_lookup( | return api_lookup( | ||||
service.lookup_directory, sha1_git, | service.lookup_directory, sha1_git, | ||||
notfound_msg=error_msg_nopath, | notfound_msg=error_msg_nopath, | ||||
enrich_fn=utils.enrich_directory) | enrich_fn=utils.enrich_directory, | ||||
request=request) |