You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2021/06/22 20:59:33 UTC

[airavata-django-portal-sdk] branch mft-integration updated (7cb087c -> 45bfff1)

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a change to branch mft-integration
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal-sdk.git.


    from 7cb087c  AIRAVATA-3420 backwards compatible /api/download
     new 5d0f4e5  AIRAVATA-3420 Fix dependency on DRF
     new 3ac051a  Revert "AIRAVATA-3460 Pass path as request param"
     new 45bfff1  AIRAVATA-3420 Check if 'path' in create directory response

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 airavata_django_portal_sdk/user_storage/api.py | 46 ++++++++++++++------------
 setup.py                                       |  2 +-
 2 files changed, 26 insertions(+), 22 deletions(-)

[airavata-django-portal-sdk] 02/03: Revert "AIRAVATA-3460 Pass path as request param"

Posted by ma...@apache.org.
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

commit 3ac051a1f65e8190b8d732fdcb7212fb21ae073d
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Tue Jun 22 16:45:05 2021 -0400

    Revert "AIRAVATA-3460 Pass path as request param"
    
    This reverts commit 54914bced9c5724e74005806aa1f798056f8090c.
---
 airavata_django_portal_sdk/user_storage/api.py | 41 +++++++++++++-------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/airavata_django_portal_sdk/user_storage/api.py b/airavata_django_portal_sdk/user_storage/api.py
index d102bdb..51c2b28 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/~/",
-                                data={"path": path},
+                                "/user-storage/~/{path}",
+                                path_params={"path": path},
                                 method="post",
                                 files=files)
         data = resp.json()
@@ -270,8 +270,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/~/",
-                                params={"path": path},
+                                "/user-storage/~/{path}",
+                                path_params={"path": path},
                                 raise_for_status=False)
         if resp.status_code == HTTPStatus.NOT_FOUND:
             return False
@@ -286,8 +286,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/~/",
-                                params={"path": path},
+                                "/user-storage/~/{path}",
+                                path_params={"path": path},
                                 raise_for_status=False)
         if resp.status_code == HTTPStatus.NOT_FOUND or resp.json()['isDir']:
             return None
@@ -307,8 +307,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/~/",
-                                data={"path": path},
+                                "/user-storage/~/{path}",
+                                path_params={"path": path},
                                 method="delete",
                                 raise_for_status=False)
         _raise_404(resp, f"File path does not exist {path}")
@@ -322,8 +322,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/~/",
-                                data={"path": path},
+                                "/user-storage/~/{path}",
+                                path_params={"path": path},
                                 method="delete",
                                 raise_for_status=False)
         _raise_404(resp, f"File path does not exist {path}")
@@ -336,10 +336,11 @@ 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/~/",
-                         data={"path": path,
-                               "fileContentText": fileContentText},
-                         method="put")
+                         "/user-storage/~/{path}",
+                         path_params={"path": path},
+                         method="put",
+                         data={"fileContentText": fileContentText}
+                         )
         return
     else:
         backend = get_user_storage_provider(request, storage_resource_id=storage_resource_id)
@@ -365,8 +366,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/~/",
-                                params={"path": path},
+                                "/user-storage/~/{path}",
+                                path_params={"path": path},
                                 raise_for_status=False
                                 )
         _raise_404(resp, "User storage file path does not exist")
@@ -483,8 +484,8 @@ def listdir(request, path, storage_resource_id=None):
 
     if _is_remote_api():
         resp = _call_remote_api(request,
-                                "/user-storage/~/",
-                                params={"path": path},
+                                "/user-storage/~/{path}",
+                                path_params={"path": path},
                                 )
         data = resp.json()
         for directory in data['directories']:
@@ -633,8 +634,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/~/",
-                                data={"path": path},
+                                "/user-storage/~/{path}",
+                                path_params={"path": path},
                                 method="post")
         path = resp.json()['path']
         # FIXME: should use the storage_resource_id returned from remote API call

[airavata-django-portal-sdk] 03/03: AIRAVATA-3420 Check if 'path' in create directory response

Posted by ma...@apache.org.
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

commit 45bfff18c6795eccad63edb7724ddda9e4c3a204
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Tue Jun 22 16:55:59 2021 -0400

    AIRAVATA-3420 Check if 'path' in create directory response
---
 airavata_django_portal_sdk/user_storage/api.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/airavata_django_portal_sdk/user_storage/api.py b/airavata_django_portal_sdk/user_storage/api.py
index 51c2b28..17732d8 100644
--- a/airavata_django_portal_sdk/user_storage/api.py
+++ b/airavata_django_portal_sdk/user_storage/api.py
@@ -637,7 +637,10 @@ def create_user_dir(request, path="", dir_names=(), create_unique=False, storage
                                 "/user-storage/~/{path}",
                                 path_params={"path": path},
                                 method="post")
-        path = resp.json()['path']
+        json = resp.json()
+        # 'path' is a new response attribute, for backwards compatibility check if it exists first
+        if 'path' in json:
+            path = json['path']
         # FIXME: should use the storage_resource_id returned from remote API call
         return storage_resource_id, path
     backend = get_user_storage_provider(request, storage_resource_id=storage_resource_id)

[airavata-django-portal-sdk] 01/03: AIRAVATA-3420 Fix dependency on DRF

Posted by ma...@apache.org.
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

commit 5d0f4e562e4a75149fd393291875491c5f649fcc
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Tue Jun 22 16:11:18 2021 -0400

    AIRAVATA-3420 Fix dependency on DRF
---
 setup.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index 7b36200..7709633 100644
--- a/setup.py
+++ b/setup.py
@@ -23,7 +23,7 @@ setup(
     packages=find_packages(),
     install_requires=[
         "django",
-        "django-rest-framework",
+        "djangorestframework",
         # Installed from git repo; see requirements.txt for details
         "airavata-python-sdk",
     ],