Skip to main content

collective.compoundcriterion

https://github.com/collective/collective.compoundcriterion/actions/workflows/main.yml/badge.svg https://coveralls.io/repos/collective/collective.compoundcriterion/badge.svg?branch=master&service=github

This package add a new kind of criterion available for plone.app.collection.

Motivation

Sometimes, some index are composed of different elements with a certain logic or you need to query particular elements of the site like groups of the current user or anything else. This is not achievable using default indexes and Collection UI, you need to write python code.

How to use

When adding/editing a Collection, a new criterion filed under the ‘Other’ category of available indexes called ‘Filter’ is available.

When selecting a ‘Filter’, a selection box will show you named adapter that provide the collective.compoundcriterion.interfaces.ICoumpondCriterionFilter interface.

You will be able to select among available ones. This can still be used together with other criteria.

To register this complex query builder named adapter, you will have to add this kind of code :

<adapter for="*"
         factory="collective.compoundcriterion.tests.adapter.CompoundCrietrionFilterAdapter"
         provides="collective.compoundcriterion.interfaces.ICompoundCriterionFilter"
         name="testing-compound-adapter" />

How to test

Add the adapter registration zcml here above to a configure.zcml file (like the one in collective.compoundcriterion), it will make the ‘testing-compound-adapter’ available in the Collection ‘Filter’ index.

This testing adapter will query elements of the site having string ‘special_text_to_find’ in the title. So create a document with such title and it should work.

A second adapter can be used to test :

<adapter for="*"
         factory="collective.compoundcriterion.tests.adapter.SampleCompoundCrietrionFilterAdapter"
         provides="collective.compoundcriterion.interfaces.ICompoundCriterionFilter"
         name="sample-compound-adapter" />

This one will query elements having ‘title_with_sample_text’ in the title.

Negative index adapters

Two specific adapters exist to negativize query:

  • negative-previous-index that will negativize the values of the previous index defined in the query;

  • negative-personal-labels that does the same but for ftw.labels personal labels that needs specific handling as current user id is managed in indexed values.

Translations

This product has been translated into

  • French.

  • Spanish.

You can contribute for any message missing or other new languages, join us at Plone Collective Team into Transifex.net service with all world Plone translators community.

Contributors

Changelog

0.7 (2023-04-12)

  • Do not break in negative-previous-index when some filters does not have values (so the ‘v’ is not there in the query). [gbastien]

0.6 (2023-02-13)

  • Added negative-previous-index and negative-personal-labels default adapters. Rely on imio.helpers. Removed dependency on unittest2. [gbastien]

0.5 (2021-04-20)

  • Add Transifex.net service integration to manage the translation process. [macagua]

  • Add Spanish translation [macagua]

0.4 (2018-08-31)

  • When getting the adapter, if context is not the Collection, try to get real context following various cases. This is the case when using Collection from plone.app.contenttypes. [gbastien]

  • Do not use a SelectionWidget to render the querystring widget as it does not exist anymore for plone.app.contenttypes Collection. Use the MultipleSelectionWidget. This way finally we may select several filters to build the query. [gbastien]

  • When using ‘not’ in queries for ZCatalog 3, ‘query’ level must be replaced by ‘not’ in query dictionary. [sgeulette]

0.3 (2016-12-08)

  • Return clear message when a query format is not plone.app.querystring compliant. [gbastien]

0.2 (2015-09-04)

  • Raise a KeyError if the format of the query returned by the named adapter is not compliant with what is returned by plone.app.querystring.queryparser.parseFormquery, this way it behaves correctly with collective.eeafaceted.collectionwidget. [gbastien]

0.1 (2015-06-02)

  • Initial release. [IMIO]

Release files for collective.compoundcriterion 0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for collective.compoundcriterion 0.7
File Size Uploaded
collective.compoundcriterion-0.7.tar.gz 22.6 kB Details

Release files / collective.compoundcriterion-0.7.tar.gz

Download URL collective.compoundcriterion-0.7.tar.gz
Size 22.6 kB
Tags Source
SHA-256 checksum
How to use checksums
000f444fb51df0903738838dce5a6b3f9bba730604df3aaff106c55774c80a88
BLAKE2b-256 checksum
How to use checksums
e7683100f5dae6b28112430a41640c118ffed924c8597b06b178817f1b2ae730
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.7.0 requests/2.25.1 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/2.7.18

Release history Release notifications | RSS feed

This release

0.7 This release

1 release file

0.6

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page