Skip to content

Commit

Permalink
fix(logic): datadict versions;
Browse files Browse the repository at this point in the history
- CKAN versioning for data dictionary interfaces.
  • Loading branch information
JVickery-TBS committed Dec 9, 2024
1 parent 20a33f6 commit e4aac5d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ckanext/xloader/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def load_csv(csv_filepath, resource_id, mimetype='text/csv', logger=None):
existing = datastore_resource_exists(resource_id)
existing_info = {}
if existing:
if p.toolkit.check_ckan_version(min_version='2.10'):
if p.toolkit.check_ckan_version(min_version='2.11'):
ds_info = p.toolkit.get_action('datastore_info')({'ignore_auth': True}, {'id': resource_id})
existing_fields = ds_info.get('fields', [])
else:
Expand Down Expand Up @@ -412,7 +412,7 @@ def load_table(table_filepath, resource_id, mimetype='text/csv', logger=None):
existing = datastore_resource_exists(resource_id)
existing_info = None
if existing:
if p.toolkit.check_ckan_version(min_version='2.10'):
if p.toolkit.check_ckan_version(min_version='2.11'):
ds_info = p.toolkit.get_action('datastore_info')({'ignore_auth': True}, {'id': resource_id})
existing_fields = ds_info.get('fields', [])
else:
Expand Down
2 changes: 1 addition & 1 deletion ckanext/xloader/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def convert_types(self, extended_rows):
row[cell_index] = ''
if self.fields:
# only strip white space if strip_extra_white is True
if self.fields[cell_index].get('strip_extra_white', True) and isinstance(cell_value, six.text_type):
if self.fields[cell_index].get('info', {}).get('strip_extra_white', True) and isinstance(cell_value, six.text_type):
cell_value = cell_value.strip()
row[cell_index] = cell_value.strip()
if not cell_value:
Expand Down

0 comments on commit e4aac5d

Please sign in to comment.