in airavata_django_portal_sdk/user_storage/api.py [0:0]
def dir_exists(request, path, storage_resource_id=None, experiment_id=None):
"""
Return True if path exists in user's data store. If `experiment_id` provided
then the path will be relative to the experiment data directory.
"""
if remoteapi.is_remote_api_configured():
resp = remoteapi.call(request,
"/user-storage/~/",
params={"path": path, "experiment-id": experiment_id},
raise_for_status=False)
if resp.status_code == HTTPStatus.NOT_FOUND:
return False
resp.raise_for_status()
return resp.json()['isDir']
else:
final_path, owner_username = _get_final_path_and_owner_username(request, path, experiment_id)
backend = get_user_storage_provider(
request, storage_resource_id=storage_resource_id, owner_username=owner_username)
return backend.is_dir(final_path)