Skip to content

Commit 2f628f8

Browse files
committed
crator criteria porting
1 parent 18772d3 commit 2f628f8

File tree

9 files changed

+66
-17
lines changed

9 files changed

+66
-17
lines changed

CHANGES.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Changelog
44
5.5.13 (unreleased)
55
-------------------
66

7-
- Nothing changed yet.
8-
7+
- Use custom creator criteria to list only creators present in the catalog to avoid an empty list when using LDAP and many_users flag
8+
[folix-01]
99

1010
5.5.12 (2025-07-02)
1111
-------------------
@@ -33,7 +33,7 @@ Changelog
3333
[mamico]
3434
- Fix issue with event search in @querystring-search override:
3535
converting a timezone-aware DateTime to utcdatetime causes a problem when searching for
36-
"today", as it shifts start=day x at 00:00 to start=day x-1 at 22:00 in GMT+2 timezone.
36+
"today", as it shifts start=day x at 00:00 to start=day x-1 at 22:00 in GMT+2 timezone.
3737
[lucabel]
3838

3939

@@ -116,7 +116,7 @@ Changelog
116116
- Add dependency with collective.volto.sitesettings.
117117
[cekk]
118118

119-
119+
120120
5.4.9 (2024-04-22)
121121
------------------
122122

src/redturtle/volto/configure.zcml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<include package=".browser" />
1414
<include package=".restapi" />
1515
<include package=".types" />
16+
<include package=".vocabularies" />
1617

1718
<include file="indexers.zcml" />
1819
<include file="monkey.zcml" />

src/redturtle/volto/profiles/default/metadata.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<metadata>
3-
<version>4308</version>
3+
<version>4309</version>
44
<dependencies>
55
<dependency>profile-plone.volto:default</dependency>
66
<dependency>profile-plone.app.caching:with-caching-proxy</dependency>

src/redturtle/volto/profiles/default/registry/criteria.xml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@
44
i18n:domain="redturtle.volto">
55

66

7-
<records interface="plone.app.querystring.interfaces.IQueryField"
8-
prefix="plone.app.querystring.field.exclude_from_nav">
9-
<value key="title" i18n:translate="">Show elements excluded from navigation</value>
10-
<value key="description" i18n:translate="">Select False to show only elements not excluded from navigation.</value>
11-
<value key="enabled">True</value>
12-
<value key="sortable">False</value>
13-
<value key="operations">
14-
<element>plone.app.querystring.operation.boolean.isTrue</element>
15-
<element>plone.app.querystring.operation.boolean.isFalse</element>
16-
</value>
17-
<value key="group" i18n:translate="">Metadata</value>
18-
</records>
7+
<records interface="plone.app.querystring.interfaces.IQueryField"
8+
prefix="plone.app.querystring.field.exclude_from_nav">
9+
<value key="title" i18n:translate="">Show elements excluded from navigation</value>
10+
<value key="description" i18n:translate="">Select False to show only elements not excluded from navigation.</value>
11+
<value key="enabled">True</value>
12+
<value key="sortable">False</value>
13+
<value key="operations">
14+
<element>plone.app.querystring.operation.boolean.isTrue</element>
15+
<element>plone.app.querystring.operation.boolean.isFalse</element>
16+
</value>
17+
<value key="group" i18n:translate="">Metadata</value>
18+
</records>
19+
20+
<records interface="plone.app.querystring.interfaces.IQueryField" prefix="plone.app.querystring.field.Creator" purge="False">
21+
<value key="vocabulary">redturtle.volto.vocabularies.Creators</value>
22+
</records>
1923

2024
</registry>

src/redturtle/volto/upgrades.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
from Acquisition import aq_base
33
from copy import deepcopy
44
from plone import api
5+
from plone.app.querystring.interfaces import IQueryField
56
from plone.app.upgrade.utils import installOrReinstallProduct
67
from plone.dexterity.utils import iterSchemata
8+
from plone.registry.interfaces import IRegistry
79
from plone.restapi.behaviors import IBlocks
810
from redturtle.volto.setuphandlers import remove_custom_googlebot
911
from uuid import uuid4
12+
from zope.component import getUtility
1013
from zope.schema import getFields
1114

1215

@@ -594,3 +597,11 @@ def should_reindex(blocks):
594597
logger.info(f"Reindex complete. Reindexed {len(reindexed)} contents:")
595598
for url in reindexed:
596599
logger.info(f"- {url}")
600+
601+
602+
def to_4409(context):
603+
registry = getUtility(IRegistry)
604+
settings = registry.forInterface(
605+
IQueryField, prefix="plone.app.querystring.field.Creator"
606+
)
607+
settings.vocabulary = "redturtle.volto.vocabularies.Creators"

src/redturtle/volto/upgrades.zcml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,12 @@
256256
destination="4308"
257257
handler=".upgrades.to_4308"
258258
/>
259+
<genericsetup:upgradeStep
260+
title="Change vocabulary for Creator criteria"
261+
description=""
262+
profile="redturtle.volto:default"
263+
source="4308"
264+
destination="4309"
265+
handler=".upgrades.to_4309"
266+
/>
259267
</configure>

src/redturtle/volto/vocabularies/__init__.py

Whitespace-only changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<configure
2+
xmlns="http://namespaces.zope.org/zope"
3+
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
4+
xmlns:i18n="http://namespaces.zope.org/i18n"
5+
xmlns:plone="http://namespaces.plone.org/plone"
6+
i18n_domain="redturtle.volto"
7+
>
8+
9+
<utility
10+
factory=".principals.CreatorsVocabulary"
11+
name="redturtle.volto.vocabularies.Creators"
12+
/>
13+
14+
</configure>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from plone.app.vocabularies.catalog import KeywordsVocabulary
2+
from zope.interface import implementer
3+
from zope.schema.interfaces import IVocabularyFactory
4+
5+
6+
@implementer(IVocabularyFactory)
7+
class CreatorsVocabulary(KeywordsVocabulary):
8+
keyword_index = "Creator"
9+
10+
11+
CreatorsVocabularyFactory = CreatorsVocabulary()

0 commit comments

Comments
 (0)