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 2020/11/02 19:38:39 UTC

[airavata-django-portal-sdk] branch master updated: AIRAVATA-3346 Restoring user_file_exists

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 a084291  AIRAVATA-3346 Restoring user_file_exists
a084291 is described below

commit a0842917d462afacea34edf8364f138edee28536
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Mon Nov 2 14:37:25 2020 -0500

    AIRAVATA-3346 Restoring user_file_exists
---
 airavata_django_portal_sdk/user_storage.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/airavata_django_portal_sdk/user_storage.py b/airavata_django_portal_sdk/user_storage.py
index 808830b..d98c508 100644
--- a/airavata_django_portal_sdk/user_storage.py
+++ b/airavata_django_portal_sdk/user_storage.py
@@ -202,6 +202,16 @@ def dir_exists(request, path):
         return _Datastore().dir_exists(request.user.username, path)
 
 
+def user_file_exists(request, path):
+    """If file exists, return data product URI, else None."""
+    if _Datastore().exists(request.user.username, path):
+        full_path = _Datastore().path(request.user.username, path)
+        data_product_uri = _get_data_product_uri(request, full_path)
+        return data_product_uri
+    else:
+        return None
+
+
 def delete_dir(request, path):
     """Delete path in user's data store, if it exists."""
     if _is_remote_api():