Skip to content

Commit

Permalink
fix: Convert boolean options to bools
Browse files Browse the repository at this point in the history
If a logic function is called via the API, all values in the data_dict will be strings, so we need to convert e.g. 'False' to a boolean or it will be treated as True.
  • Loading branch information
bellisk committed Feb 14, 2024
1 parent 8ea4b1b commit 0034bbd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ckanext/harvest/logic/action/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def harvest_object_list(context, data_dict):

session = context['session']

only_current = data_dict.get('only_current', True)
only_current = p.toolkit.asbool(data_dict.get('only_current', True))
source_id = data_dict.get('source_id', False)

query = session.query(HarvestObject)
Expand Down Expand Up @@ -371,8 +371,8 @@ def _get_sources_for_user(context, data_dict, organization_id=None, limit=None):
session = context['session']
user = context.get('user', '')

only_active = data_dict.get('only_active', False)
only_to_run = data_dict.get('only_to_run', False)
only_active = p.toolkit.asbool(data_dict.get('only_active', False))
only_to_run = p.toolkit.asbool(data_dict.get('only_to_run', False))

query = session.query(HarvestSource) \
.order_by(HarvestSource.created.desc())
Expand Down

0 comments on commit 0034bbd

Please sign in to comment.