Skip to content

Commit b555fc7

Browse files
add index and profile to add index
1 parent 42306d1 commit b555fc7

File tree

4 files changed

+45
-6
lines changed

4 files changed

+45
-6
lines changed

Diff for: CHANGES.rst

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Changelog
1111
[lucabel]
1212
- Add upgrade-step to add missing metadata for image captions.
1313
[cekk]
14+
- Add "data fine effettiva" for events, to order listing correctly
15+
[lucabel]
1416

1517

1618
6.3.4 (2025-03-07)

Diff for: src/design/plone/contenttypes/configure.zcml

+9
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@
7272
provides="Products.GenericSetup.interfaces.EXTENSION"
7373
directory="profiles/remove_eea_api_taxonomy"
7474
/>
75+
76+
<genericsetup:registerProfile
77+
name="to_7313"
78+
title="Design Plone: Content-types to 7313"
79+
description="Fix control panel of design.plone.contenttypes add-on."
80+
provides="Products.GenericSetup.interfaces.EXTENSION"
81+
directory="profiles/to_7313"
82+
/>
83+
7584
<utility
7685
factory=".setuphandlers.HiddenProfiles"
7786
name="design.plone.contenttypes-hiddenprofiles"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<registry xmlns:i18n="http://xml.zope.org/namespaces/i18n"
3+
i18n:domain="plone"
4+
>
5+
<records interface="plone.app.querystring.interfaces.IQueryField"
6+
prefix="plone.app.querystring.field.effectiveend" >
7+
<value key="title" i18n:translate="effectivestart">Data effettiva di fine evento</value>
8+
<value key="description">Criterio per ricerche che si basano sulla data effettiva di fine</value>
9+
<value key="enabled">True</value>
10+
<value key="sortable">True</value>
11+
<value key="operations">
12+
<element>plone.app.querystring.operation.date.lessThan</element>
13+
<element>plone.app.querystring.operation.date.largerThan</element>
14+
<element>plone.app.querystring.operation.date.between</element>
15+
<element>plone.app.querystring.operation.date.lessThanRelativeDate</element>
16+
<element>plone.app.querystring.operation.date.largerThanRelativeDate</element>
17+
<element>plone.app.querystring.operation.date.today</element>
18+
<element>plone.app.querystring.operation.date.beforeToday</element>
19+
<element>plone.app.querystring.operation.date.afterToday</element>
20+
<element>plone.app.querystring.operation.date.beforeRelativeDate</element>
21+
<element>plone.app.querystring.operation.date.afterRelativeDate</element>
22+
</value>
23+
<value i18n:translate="" i18n:domain="plone" key="group">Dates</value>
24+
</records>
25+
</registry>

Diff for: src/design/plone/contenttypes/upgrades/to_730x.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -201,21 +201,24 @@ def to_7312(context):
201201

202202
def to_7313(context):
203203
logger.info("Update registry")
204-
update_registry(context)
205-
logger.info("Add new effectiveend (DateRecurringIndex) index")
204+
context.runImportStepFromProfile(
205+
"profile-design.plone.contenttypes:to_7313",
206+
"plone.app.registry", False)
206207

208+
logger.info("Add new effectiveend (DateRecurringIndex) index")
207209
class extra:
208210
recurdef = "recurrence"
209211
until = ""
210212

211213
name = "effectiveend"
212214
catalog = api.portal.get_tool(name="portal_catalog")
213-
catalog.addIndex(name, "DateRecurringIndex", extra=extra())
214-
logger.info("Catalog DateRecurringIndex {} created.".format(name))
215+
216+
if 'effectiveend' not in catalog.indexes():
217+
catalog.addIndex(name, "DateRecurringIndex", extra=extra())
218+
logger.info("Catalog DateRecurringIndex {} created.".format(name))
215219

216220
logger.info("Reindex Events")
217-
pc = api.portal.get_tool(name="portal_catalog")
218-
brains = pc(portal_type="Event")
221+
brains = catalog(portal_type="Event")
219222
tot = len(brains)
220223
for i, brain in enumerate(brains):
221224
if i % 15 == 0:

0 commit comments

Comments
 (0)