Skip to content

Commit f5aacc1

Browse files
committed
Use request_args for suppress_reindex
1 parent 59f5ce0 commit f5aacc1

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ def create_entity(entity_type):
11771177
#
11781178
# Check if re-indexing is to be suppressed after entity creation.
11791179
try:
1180-
supress_reindex = schema_manager.suppress_reindex(request)
1180+
supress_reindex = schema_manager.suppress_reindex(request.args)
11811181
except Exception as e:
11821182
bad_request_error(e)
11831183

@@ -1486,7 +1486,7 @@ def update_entity(id):
14861486
#
14871487
# Check if re-indexing is to be suppressed after entity creation.
14881488
try:
1489-
suppress_reindex = schema_manager.suppress_reindex(request)
1489+
suppress_reindex = schema_manager.suppress_reindex(request.args)
14901490
except Exception as e:
14911491
bad_request_error(e)
14921492

@@ -4122,7 +4122,7 @@ def multiple_components():
41224122
#
41234123
# Check if re-indexing is to be suppressed after entity creation.
41244124
try:
4125-
suppress_reindex = schema_manager.suppress_reindex(request)
4125+
suppress_reindex = schema_manager.suppress_reindex(request.args)
41264126
except Exception as e:
41274127
bad_request_error(e)
41284128

src/schema/schema_manager.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2363,28 +2363,28 @@ def get_organ_types():
23632363

23642364

23652365
"""
2366-
Use the Flask request.args MultiDict to see if 'reindex' is a URL parameter passed in with the
2367-
request and if it indicates reindexing should be supressed. Default to reindexing in all other cases.
2366+
See if 'reindex' is a URL parameter passed in with the request and
2367+
if it indicates reindexing should be supressed. Default to reindexing in all other cases.
23682368
23692369
Parameters
23702370
----------
2371-
request: Flask request object
2372-
The instance of Flask request passed in from application request
2371+
request_args: ImmutableMultiDict
2372+
The Flask request.args passed in from application request
23732373
23742374
Returns
23752375
-------
23762376
bool
23772377
"""
2378-
def suppress_reindex(request) -> bool:
2379-
if 'reindex' not in request.args:
2378+
def suppress_reindex(request_args) -> bool:
2379+
if 'reindex' not in request_args:
23802380
return False
2381-
reindex_str = request.args.get('reindex').lower()
2381+
reindex_str = request_args.get('reindex').lower()
23822382
if reindex_str == 'false':
23832383
return True
23842384
elif reindex_str == 'true':
23852385
return False
23862386
raise Exception(f"The value of the 'reindex' parameter must be True or False (case-insensitive)."
2387-
f" '{request.args.get('reindex')}' is not recognized.")
2387+
f" '{request_args.get('reindex')}' is not recognized.")
23882388

23892389

23902390
####################################################################################################

src/schema/schema_triggers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1737,7 +1737,7 @@ def update_status(property_key, normalized_type, request_args, user_token, exist
17371737
# When the parent dataset status update disables reindex via query string '?reindex=false'
17381738
# We'll also disable the reindex call to search-api upon each subsequent child component dataset update
17391739
reindex = 'followed'
1740-
if schema_manager.suppress_reindex(request):
1740+
if schema_manager.suppress_reindex(request_args):
17411741
url += '?reindex=false'
17421742
reindex = 'suppressed'
17431743

0 commit comments

Comments
 (0)