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/10/04 22:27:06 UTC

[airavata-django-portal-sdk] branch master updated: AIRAVATA-3346 Fix handling default value of path_params

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 70ae23b  AIRAVATA-3346 Fix handling default value of path_params
70ae23b is described below

commit 70ae23b60adfd03806ca5eddf4ae80f3700b5d3a
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Sun Oct 4 18:26:45 2020 -0400

    AIRAVATA-3346 Fix handling default value of path_params
---
 README.md                                  | 20 +++++++++++++++++++-
 airavata_django_portal_sdk/user_storage.py |  7 ++++---
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 5779cf1..219a613 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,25 @@
 # Airavata Django Portal SDK
 
+The Airavata Django Portal SDK provides libraries that assist in developing
+custom Django app extensions to the
+[Airavata Django Portal](https://github.com/apache/airavata-django-portal).
+
+See the documentation at https://airavata-django-portal-sdk.readthedocs.io/ for
+more details.
+
+## Getting Started
+
+To integrate the SDK with an Airavata Django Portal custom app, add
+
+```
+"airavata-django-portal-sdk @ git+https://github.com/apache/airavata-django-portal-sdk.git@master#egg=airavata-django-portal-sdk",
+```
+
+to the `install_requires` list in your setup.py file. Then with your virtual
+environment activated, reinstall your Django app with
+
 ```
-pip install .
+pip install -e .
 ```
 
 ## Migrations
diff --git a/airavata_django_portal_sdk/user_storage.py b/airavata_django_portal_sdk/user_storage.py
index 5c3a832..9983e8d 100644
--- a/airavata_django_portal_sdk/user_storage.py
+++ b/airavata_django_portal_sdk/user_storage.py
@@ -545,7 +545,7 @@ def _is_remote_api():
 def _call_remote_api(
         request,
         path,
-        path_params=dict,
+        path_params=None,
         method="get",
         raise_for_status=True,
         **kwargs):
@@ -553,8 +553,9 @@ def _call_remote_api(
     headers = {
         'Authorization': f'Bearer {request.authz_token.accessToken}'}
     encoded_path_params = {}
-    for pk, pv in path_params.items():
-        encoded_path_params[pk] = quote(pv)
+    if path_params is not None:
+        for pk, pv in path_params.items():
+            encoded_path_params[pk] = quote(pv)
     encoded_path = path.format(**encoded_path_params)
     logger.debug(f"encoded_path={encoded_path}")
     r = requests.request(