Skip to content

Metadata: avoid triggering a save signal when saving metadata #13543

@etj

Description

@etj

We may need to save the metadata within a complex flow, so that the final processing implemented by the post_save signals are only needed at the end of the flow.

Also, since the metadata storers may call the MetadataManager.update_schema_instance() method, and the storers are invoked in a post_save function, an infinite recursive loop may happen.

Proposal:

  • Handlers changing the fields in the ResourceBase instance should store the new value in the context, in a dict fieldname: fieldvalue withing the base context key.
  • The metadata manager should perform an update() using the dict populated by the handlers, so that signals are not triggered.

The only caller so far is the schema/instance/<pk> API call, so in the caller view the resource.save() should be invoked in order to run the post_save procedures.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions