Skip to content

Current change is not visible in after_resource_update hook #9557

Description

@ThrawnCA

CKAN version

2.12

Describe the bug

The after_resource_update plugin hook receives an updated resource that is not yet committed, so if it attempts to use resource_show, or if it calls any other APIs that do so, then the result is the old version of the resource.

Steps to reproduce

  • Create a plugin that implements IResourceController with an after_resource_update
  • Within after_resource_update, call resource_show, passing the ID from the data_dict parameter.
  • Result is the pre-update resource.

Expected behavior

Calling resource_show should result in the current version of the resource, which at the point of the after update hook, should be the updated version.

Additional details

ckanext-validation encountered errors because of this. I'm currently rewriting it to pass the full resource dict to an API via the context, which is obviously undesirable.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions