-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Overview
Code like this was sometimes failing with Exception: Action function package_show did not call its auth function:
def some_helper():
context = {'model': model}
# Get datasets
datasets = []
ids = normalize_list(value)
for id in ids:
try:
dataset = tk.get_action('package_show')(context, {'id': id})
href = tk.url_for('ckanext_showcase_read', id=dataset['name'], qualified=False)
datasets.append({'text': dataset['title'], 'href': href})
except tk.ObjectNotFound:
pass
return datasets
Moving context definition inside the cycle solved this problem:
def some_helper():
# Get datasets
datasets = []
ids = normalize_list(value)
for id in ids:
try:
dataset = tk.get_action('package_show')({'model': model}, {'id': id})
href = tk.url_for('ckanext_showcase_read', id=dataset['name'], qualified=False)
datasets.append({'text': dataset['title'], 'href': href})
except tk.ObjectNotFound:
pass
return datasets
We have more functions like this but it seems it doesn't create any problems, for now. But anyway it makes sense to double check.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request