Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Allow ReferenceWidgetAdapter to be exclusive #195

Merged
merged 5 commits into from
Jul 7, 2020
Merged

Conversation

xispa
Copy link
Member

@xispa xispa commented Jul 7, 2020

Description of the issue/feature this PR addresses

ReferenceWidgetAdapter allows to change searches specified in the reference widget on-the-fly. This allows to redefine the search based on current context, on values from other fields, etc. This is mostly used to filter queries by client in different contexts. However, if multiple ReferenceWidgetAdapters are found for a given context, the system calls them sequentially and follows an "additive" approach (brains returned by each adapter are being added).

This Pull Request adds the IExclusiveReferenceWidgetAdapter, so when an adapter of this type is found, the system behaves differently by dismissing the rest of adapters.

Current behavior before PR

System always handle brains returned by ReferenceWidgetAdapter in an "additive" manner.

Desired behavior after PR is merged

System can return a subset of brains when an IExclusiveReferenceWidgetAdapter is used.

--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.

@xispa xispa requested a review from ramonski July 7, 2020 11:03
@ramonski ramonski merged commit 004ef7f into 1.x Jul 7, 2020
@ramonski ramonski deleted the exclusive-adapters branch July 7, 2020 18:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

2 participants