File tree 9 files changed +110
-2
lines changed
src/design/plone/contenttypes
9 files changed +110
-2
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,12 @@ Changelog
11
11
[lucabel]
12
12
- Add upgrade-step to add missing metadata for image captions.
13
13
[cekk]
14
+ - Add "data fine effettiva" for events, to order listing correctly
15
+ [lucabel]
14
16
- Fix typo in Venue serializer that didn't return the right history version.
15
17
[cekk]
16
18
19
+
17
20
6.3.4 (2025-03-07)
18
21
------------------
19
22
Original file line number Diff line number Diff line change 72
72
provides =" Products.GenericSetup.interfaces.EXTENSION"
73
73
directory =" profiles/remove_eea_api_taxonomy"
74
74
/>
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
+
75
84
<utility
76
85
factory =" .setuphandlers.HiddenProfiles"
77
86
name =" design.plone.contenttypes-hiddenprofiles"
Original file line number Diff line number Diff line change 8
8
factory =" .events.effectivestart"
9
9
name =" effectivestart"
10
10
/>
11
+ <adapter
12
+ factory =" .events.effectiveend"
13
+ name =" effectiveend"
14
+ />
11
15
<adapter
12
16
factory =" .pagina_argomento.SearchableTextExtender"
13
17
name =" IPaginaArgomento"
Original file line number Diff line number Diff line change 2
2
from plone .app .contenttypes .interfaces import IEvent
3
3
from plone .indexer .decorator import indexer
4
4
from plone .event .interfaces import IEventAccessor
5
+ from plone .event .interfaces import IRecurrenceSupport
5
6
6
7
7
8
@indexer (IEvent )
@@ -26,3 +27,15 @@ def effectivestart(obj):
26
27
if not start :
27
28
raise AttributeError
28
29
return start
30
+
31
+
32
+ @indexer (IEvent )
33
+ def effectiveend (obj ):
34
+ occurrences = IRecurrenceSupport (obj ).occurrences ()
35
+ end = obj .end
36
+ for occurrence in list (occurrences ):
37
+ if occurrence .end > end :
38
+ end = occurrence .end
39
+ if obj .title :
40
+ print (f"{ obj .title } - { end } " )
41
+ return end
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" utf-8" ?>
2
2
<metadata >
3
- <version >7312 </version >
3
+ <version >7313 </version >
4
4
<dependencies >
5
5
<dependency >profile-redturtle.bandi:default</dependency >
6
6
<dependency >profile-collective.venue:default</dependency >
Original file line number Diff line number Diff line change 588
588
</value >
589
589
<value i18n : translate =" " i18n : domain =" plone" key =" group" >Dates</value >
590
590
</records >
591
-
591
+ <records interface =" plone.app.querystring.interfaces.IQueryField"
592
+ prefix =" plone.app.querystring.field.effectiveend" >
593
+ <value key =" title" i18n : translate =" effectivestart" >Data effettiva di fine evento</value >
594
+ <value key =" description" >Criterio per ricerche che si basano sulla data effettiva di fine</value >
595
+ <value key =" enabled" >True</value >
596
+ <value key =" sortable" >True</value >
597
+ <value key =" operations" >
598
+ <element >plone.app.querystring.operation.date.lessThan</element >
599
+ <element >plone.app.querystring.operation.date.largerThan</element >
600
+ <element >plone.app.querystring.operation.date.between</element >
601
+ <element >plone.app.querystring.operation.date.lessThanRelativeDate</element >
602
+ <element >plone.app.querystring.operation.date.largerThanRelativeDate</element >
603
+ <element >plone.app.querystring.operation.date.today</element >
604
+ <element >plone.app.querystring.operation.date.beforeToday</element >
605
+ <element >plone.app.querystring.operation.date.afterToday</element >
606
+ <element >plone.app.querystring.operation.date.beforeRelativeDate</element >
607
+ <element >plone.app.querystring.operation.date.afterRelativeDate</element >
608
+ </value >
609
+ <value i18n : translate =" " i18n : domain =" plone" key =" group" >Dates</value >
610
+ </records >
592
611
</registry >
Original file line number Diff line number Diff line change
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 >
Original file line number Diff line number Diff line change 941
941
destination =" 7312"
942
942
handler =" .to_730x.to_7312"
943
943
/>
944
+ <genericsetup : upgradeStep
945
+ title =" Add caption metadata"
946
+ profile =" design.plone.contenttypes:default"
947
+ source =" 7312"
948
+ destination =" 7313"
949
+ handler =" .to_730x.to_7313"
950
+ />
944
951
</configure >
Original file line number Diff line number Diff line change @@ -197,3 +197,31 @@ def to_7312(context):
197
197
for column in ["image_caption" , "preview_caption" ]:
198
198
if column not in pc .schema ():
199
199
pc .addColumn (column )
200
+
201
+
202
+ def to_7313 (context ):
203
+ logger .info ("Update registry" )
204
+ context .runImportStepFromProfile (
205
+ "profile-design.plone.contenttypes:to_7313" , "plone.app.registry" , False
206
+ )
207
+
208
+ logger .info ("Add new effectiveend (DateRecurringIndex) index" )
209
+
210
+ class extra :
211
+ recurdef = "recurrence"
212
+ until = ""
213
+
214
+ name = "effectiveend"
215
+ catalog = api .portal .get_tool (name = "portal_catalog" )
216
+
217
+ if "effectiveend" not in catalog .indexes ():
218
+ catalog .addIndex (name , "DateRecurringIndex" , extra = extra ())
219
+ logger .info ("Catalog DateRecurringIndex {} created." .format (name ))
220
+
221
+ logger .info ("Reindex Events" )
222
+ brains = catalog (portal_type = "Event" )
223
+ tot = len (brains )
224
+ for i , brain in enumerate (brains ):
225
+ if i % 15 == 0 :
226
+ logger .info ("Progress: {}/{}" .format (i , tot ))
227
+ brain .getObject ().reindexObject (idxs = ["effectiveend" ])
You can’t perform that action at this time.
0 commit comments