Skip to content

Don't process extra resources on resource_create#74

Draft
amercader wants to merge 1 commit intomasterfrom
fix-multiple-calls-on-resource_create
Draft

Don't process extra resources on resource_create#74
amercader wants to merge 1 commit intomasterfrom
fix-multiple-calls-on-resource_create

Conversation

@amercader
Copy link
Member

In async mode, if a dataset already has one or more resources suitable for validation, when adding a new one all the previous ones are also sent to validate.

@ThrawnCA patch in #67, dealt with the same scenario but when updating an existing resource.

In this case sadly we need to use the context, as there is no way to reliably tell in after_update if it's part of a resource_create call

In async mode, if a dataset already has one or more resources suitable
for validation, when adding a new one all the previous ones are also
sent to validate.

@ThrawnCA patch in #67, dealt with the same scenario but when updating
an existing resource.

In this case sadly we need to use the context, as there is no way to
reliably tell in `after_update` if it's part of a resource_create call
@amercader amercader marked this pull request as draft October 27, 2022 14:17
if is_dataset:
return self._process_schema_fields(data_dict)
else:
context["_resource_create_call"] = True
Copy link
Contributor

Choose a reason for hiding this comment

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

CKAN 2.10 will restrict the allowed context keys...

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants