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
commit b1931a8037ac192808e19c654bb0774cf993518d Author: Marcus Christie <[email protected]> AuthorDate: Fri Jul 24 10:31:47 2020 -0400 AIRAVATA-3342 Lazy load models An error occurred while generating documentation because of missing Django settings module. Rather than attempt to configure a settings module so that documentation can be generated, I decided to just lazy load the models. --- airavata_django_portal_sdk/user_storage.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/airavata_django_portal_sdk/user_storage.py b/airavata_django_portal_sdk/user_storage.py index a4a7b27..59d1e26 100644 --- a/airavata_django_portal_sdk/user_storage.py +++ b/airavata_django_portal_sdk/user_storage.py @@ -16,7 +16,6 @@ from airavata.model.data.replica.ttypes import (DataProductModel, ReplicaLocationCategory, ReplicaPersistentType) -from . import models import copy logger = logging.getLogger(__name__) @@ -210,6 +209,7 @@ def get_rel_path(request, path): def _get_data_product_uri(request, full_path): + from airavata_django_portal_sdk import models user_file = models.UserFiles.objects.filter( username=request.user.username, file_path=full_path) if user_file.exists(): @@ -234,6 +234,7 @@ def _register_data_product(request, full_path, data_product): product_uri = request.airavata_client.registerDataProduct( request.authz_token, data_product ) + from airavata_django_portal_sdk import models user_file_instance = models.UserFiles( username=request.user.username, file_path=full_path, file_dpu=product_uri ) @@ -264,6 +265,7 @@ def _copy_data_product(request, data_product, full_path): def _delete_data_product(username, full_path): # TODO: call API to delete data product from replica catalog when it is # available (not currently implemented) + from airavata_django_portal_sdk import models user_file = models.UserFiles.objects.filter(username=username, file_path=full_path) if user_file.exists(): user_file.delete()
