Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layered listing searchable text adapter lookup #2412

Merged
merged 3 commits into from
Oct 28, 2023

Conversation

ramonski
Copy link
Contributor

Description of the issue/feature this PR addresses

This PR changes the signature for listing searchable text adapters to include the request layer as well:

text_providers = getAdapters((instance, api.get_request(), catalog),
                             IListingSearchableTextProvider)

This avoids an adapter registration clash with add-ons that are not installed:

For: ('adapter', (<InterfaceClass bika.lims.interfaces.IAnalysisRequest>, <InterfaceClass senaite.core.interfaces.catalog.ISampleCatalog>), <InterfaceClass bika.lims.interfaces.IListingSearchableTextProvider>, u'')
    File "senaite/patient/catalog/indexer/configure.zcml", line 10.2-14.55
        <adapter
            for="bika.lims.interfaces.IAnalysisRequest
                 senaite.core.interfaces.ISampleCatalog"
            provides="bika.lims.interfaces.IListingSearchableTextProvider"
            factory=".sample.ListingSearchableTextProvider"/>
    File "my.lims/src/my/lims/adapters/configure.zcml", line 8.4-8.72
          <adapter factory=".searchable_text.ListingSearchableTextProvider" />

Current behavior before PR

Searchable text adapters are called from any add-on (even if not installed).

Desired behavior after PR is merged

Searchable text adapters are called only for active add-ons and are registered with the request as well.

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

Copy link
Member

@xispa xispa left a comment

Choose a reason for hiding this comment

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

Thanks! I suggest to create another PR for the definitive removal of the call to non-layered adapters, for 2.6.0

@xispa xispa merged commit d0208d3 into 2.x Oct 28, 2023
2 checks passed
@xispa xispa deleted the listing-searchable-text-adapter-lookup branch October 28, 2023 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants