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/05/06 14:10:13 UTC

[airavata-django-portal-sdk] branch master updated: In remote API `exists()`, handle case where data product itself doesn't exist

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 069af28  In remote API `exists()`, handle case where data product itself doesn't exist
069af28 is described below

commit 069af28ad9cacbeae075d7f4d626096820b43f0b
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu May 6 10:07:37 2021 -0400

    In remote API `exists()`, handle case where data product itself doesn't exist
---
 airavata_django_portal_sdk/user_storage.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/airavata_django_portal_sdk/user_storage.py b/airavata_django_portal_sdk/user_storage.py
index 76d749a..6937ee4 100644
--- a/airavata_django_portal_sdk/user_storage.py
+++ b/airavata_django_portal_sdk/user_storage.py
@@ -198,7 +198,11 @@ def exists(request, data_product=None, data_product_uri=None):
         resp = _call_remote_api(
             request,
             "/data-products/",
-            params={'product-uri': data_product.productUri})
+            params={'product-uri': data_product.productUri},
+            raise_for_status=False)
+        if resp.status_code == HTTPStatus.NOT_FOUND:
+            return False
+        resp.raise_for_status()
         data = resp.json()
         return data['downloadURL'] is not None
     else: