Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proof of concept for new config option: ckanext.xloader.site_url #234

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ckanext/xloader/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@ def direct_load():
set_datastore_active(data, resource, logger)
if 'result_url' in input:
job_dict['status'] = 'running_but_viewable'
callback_xloader_hook(result_url=input['result_url'],
callback_url = config.get('ckanext.xloader.site_url') or config.get('ckan.site_url')
callback_url = urljoin(
callback_url.rstrip('/'), '/api/3/action/xloader_hook')
result_url = callback_url
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why create result_url at all?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean assign callback_url back to result_url ? I'm try to minimise changes to the rest of the XLoader code. If you think I should just use callback_url then I can do that

Copy link
Collaborator

@ThrawnCA ThrawnCA Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're already changing from result_url=input['result_url'] to result_url=result_url. Why not just change it to result_url=callback_url? Or just call it result_url instead of callback_url on line 215 in the first place.

callback_xloader_hook(result_url=result_url,
api_key=api_key,
job_dict=job_dict)
logger.info('Data now available to users: %s', resource_ckan_url)
Expand Down
Loading