fix: name the site user when creating or deleting datastore tables (CKAN 2.11+ activity plugin) - #341
Open
chriswydra wants to merge 1 commit into
Conversation
From CKAN 2.11 the activity plugin requires context["user"] on every action
that records an activity. datastore_create and datastore_delete both patch
the resource and resource_delete records one, so on CKAN 2.11+ with the
activity plugin enabled every push fails with
ValidationError: {"user_id": ["User not found"]}. The other calls in this
module already use the site user; these three now do too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From CKAN 2.11 the
activityplugin requirescontext["user"]on every action that records an activity, and raises otherwise.datastore_createanddatastore_deleteboth patch the resource, andresource_deleterecords an activity, so on CKAN 2.11 and 2.12 withactivityenabled every push fails:The other calls in this module already build their context from
get_site_user; this adds a small_site_user_context()helper and uses it for the three calls that did not. No change on CKAN 2.10, where the context user was optional.Verified on a CKAN 2.12.0 site (activity plugin enabled): with this change a CSV upload completes and the DataStore table is created; without it the job fails as above. Follows on from #340, which covers the Python 3.14 wheel pins for the same upgrade.