This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch mft-integration
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal-sdk.git
The following commit(s) were added to refs/heads/mft-integration by this push:
new 54914bc AIRAVATA-3460 Pass path as request param
54914bc is described below
commit 54914bced9c5724e74005806aa1f798056f8090c
Author: Marcus Christie <[email protected]>
AuthorDate: Fri May 14 14:45:27 2021 -0400
AIRAVATA-3460 Pass path as request param
---
airavata_django_portal_sdk/user_storage/api.py | 41 +++++++++++++-------------
1 file changed, 20 insertions(+), 21 deletions(-)
diff --git a/airavata_django_portal_sdk/user_storage/api.py
b/airavata_django_portal_sdk/user_storage/api.py
index a959daf..c145e87 100644
--- a/airavata_django_portal_sdk/user_storage/api.py
+++ b/airavata_django_portal_sdk/user_storage/api.py
@@ -82,8 +82,8 @@ def save(request, path, file, name=None, content_type=None,
storage_resource_id=
files = {'file': (name, file, content_type)
if content_type is not None else file, }
resp = _call_remote_api(request,
- "/user-storage/~/{path}",
- path_params={"path": path},
+ "/user-storage/~/",
+ data={"path": path},
method="post",
files=files)
data = resp.json()
@@ -267,8 +267,8 @@ def dir_exists(request, path, storage_resource_id=None):
"Return True if path exists in user's data store."
if _is_remote_api():
resp = _call_remote_api(request,
- "/user-storage/~/{path}",
- path_params={"path": path},
+ "/user-storage/~/",
+ params={"path": path},
raise_for_status=False)
if resp.status_code == HTTPStatus.NOT_FOUND:
return False
@@ -283,8 +283,8 @@ def user_file_exists(request, path,
storage_resource_id=None):
"""If file exists, return data product URI, else None."""
if _is_remote_api():
resp = _call_remote_api(request,
- "/user-storage/~/{path}",
- path_params={"path": path},
+ "/user-storage/~/",
+ params={"path": path},
raise_for_status=False)
if resp.status_code == HTTPStatus.NOT_FOUND or resp.json()['isDir']:
return None
@@ -304,8 +304,8 @@ def delete_dir(request, path, storage_resource_id=None):
"""Delete path in user's data store, if it exists."""
if _is_remote_api():
resp = _call_remote_api(request,
- "/user-storage/~/{path}",
- path_params={"path": path},
+ "/user-storage/~/",
+ data={"path": path},
method="delete",
raise_for_status=False)
_raise_404(resp, f"File path does not exist {path}")
@@ -319,8 +319,8 @@ def delete_user_file(request, path,
storage_resource_id=None):
"""Delete file in user's data store, if it exists."""
if _is_remote_api():
resp = _call_remote_api(request,
- "/user-storage/~/{path}",
- path_params={"path": path},
+ "/user-storage/~/",
+ data={"path": path},
method="delete",
raise_for_status=False)
_raise_404(resp, f"File path does not exist {path}")
@@ -333,11 +333,10 @@ def delete_user_file(request, path,
storage_resource_id=None):
def update_file_content(request, path, fileContentText,
storage_resource_id=None):
if _is_remote_api():
_call_remote_api(request,
- "/user-storage/~/{path}",
- path_params={"path": path},
- method="put",
- data={"fileContentText": fileContentText}
- )
+ "/user-storage/~/",
+ data={"path": path,
+ "fileContentText": fileContentText},
+ method="put")
return
else:
backend = get_user_storage_provider(request,
storage_resource_id=storage_resource_id)
@@ -363,8 +362,8 @@ def update_data_product_content(request, data_product=None,
fileContentText="",
def get_file_metadata(request, path, storage_resource_id=None):
if _is_remote_api():
resp = _call_remote_api(request,
- "/user-storage/~/{path}",
- path_params={"path": path},
+ "/user-storage/~/",
+ params={"path": path},
raise_for_status=False
)
_raise_404(resp, "User storage file path does not exist")
@@ -481,8 +480,8 @@ def listdir(request, path, storage_resource_id=None):
if _is_remote_api():
resp = _call_remote_api(request,
- "/user-storage/~/{path}",
- path_params={"path": path},
+ "/user-storage/~/",
+ params={"path": path},
)
data = resp.json()
for directory in data['directories']:
@@ -631,8 +630,8 @@ def create_user_dir(request, path="", dir_names=(),
create_unique=False, storage
if _is_remote_api():
logger.debug(f"path={path}")
resp = _call_remote_api(request,
- "/user-storage/~/{path}",
- path_params={"path": path},
+ "/user-storage/~/",
+ data={"path": path},
method="post")
path = resp.json()['path']
# FIXME: should use the storage_resource_id returned from remote API
call