Skip to content

Commit

Permalink
Change before dataset index
Browse files Browse the repository at this point in the history
  • Loading branch information
blagojabozinovski committed Oct 30, 2024
1 parent aefa1a4 commit 00c4bbd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ckanext/alisea/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def get_helpers(self):
return {
'get_google_tag': h.get_google_tag,
'lao_current_url': h.lao_current_url,
'convert_to_list': h.convert_to_list,
}

def update_config_schema(self, schema):
Expand Down Expand Up @@ -80,8 +81,10 @@ def organization_facets(self, facet_dict, organization_type, package_type):
return OrderedDict(new_facets)

# IPackageController
def before_dataset_index(self, data_dict):
data_dict['agroecology_category'] = json.loads(data_dict.get('agroecology_category', '[]'))
data_dict['agroecology_keyword'] = json.loads(data_dict.get('agroecology_keyword', '[]'))
return data_dict
def before_dataset_index(self, package_dict):
if package_dict.get('agroecology_category'):
package_dict['agroecology_category'] = h.convert_to_list(package_dict.get('agroecology_category'))
if package_dict.get('agroecology_keyword'):
package_dict['agroecology_keyword'] = h.convert_to_list(package_dict.get('agroecology_keyword'))
return package_dict

0 comments on commit 00c4bbd

Please sign in to comment.