Skip to content

Commit

Permalink
fix: get_subject compatibility with Globus SDK v3
Browse files Browse the repository at this point in the history
  • Loading branch information
NickolausDS committed Sep 21, 2021
1 parent c05053b commit 4810708
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions globus_portal_framework/gsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import collections
import datetime
import pathlib
from packaging import version
from urllib.parse import quote_plus, unquote
import globus_sdk
from django import template
Expand Down Expand Up @@ -444,8 +445,11 @@ def get_subject(index, subject, user=None):
client = load_search_client(user)
try:
idata = get_index(index)
result = client.get_subject(idata['uuid'], unquote(subject),
result_format_version='2017-09-01')
if version.parse(globus_sdk.version.__version__).major < 3:
params = dict(result_format_version='2017-09-01')
else:
params = dict(query_params=dict(result_format_version='2017-09-01'))
result = client.get_subject(idata['uuid'], unquote(subject), **params)
return process_search_data(idata.get('fields', {}), [result.data])[0]
except globus_sdk.SearchAPIError:
return {'subject': subject, 'error': 'No data was found for subject'}
Expand Down

0 comments on commit 4810708

Please sign in to comment.