File tree Expand file tree Collapse file tree 10 files changed +93
-2
lines changed
src/design/plone/contenttypes Expand file tree Collapse file tree 10 files changed +93
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ Changelog
10
10
due to some core egg update
11
11
Code porting to work with the new plone.restapi 9.6.1 version
12
12
[lucabel]
13
+ - Add rassegna index to events
14
+ [lucabel]
13
15
14
16
15
17
6.2.8 (2024-04-22)
Original file line number Diff line number Diff line change 31
31
zope.lifecycleevent.interfaces.IObjectAddedEvent"
32
32
handler =" .common.createSubfolders"
33
33
/>
34
+ <subscriber
35
+ for =" plone.app.contenttypes.interfaces.IEvent
36
+ zope.lifecycleevent.interfaces.IObjectModifiedEvent"
37
+ handler =" .events.EventModified"
38
+ />
39
+
34
40
</configure >
Original file line number Diff line number Diff line change
1
+ from Acquisition import aq_inner , aq_parent
2
+
3
+
4
+ def EventModified (dx_event , event ):
5
+ parent = aq_parent (aq_inner (dx_event ))
6
+ if parent .portal_type == "Event" :
7
+ parent .reindexObject (idxs = ["rassegna" ])
8
+ return
Original file line number Diff line number Diff line change 77
77
factory =" .common.exclude_from_search"
78
78
name =" exclude_from_search"
79
79
/>
80
+ <adapter
81
+ factory =" .events.rassegna"
82
+ name =" rassegna"
83
+ />
84
+
80
85
<!-- only metadata -->
81
86
82
87
</configure >
Original file line number Diff line number Diff line change @@ -10,3 +10,10 @@ def event_location(context, **kw):
10
10
luoghi_correlati = filter (bool , luoghi_correlati )
11
11
luoghi_correlati_title = [x .UID () for x in luoghi_correlati ]
12
12
return luoghi_correlati_title
13
+
14
+
15
+ @indexer (IEvent )
16
+ def rassegna (context , ** kw ):
17
+ """ """
18
+ children = context .values ()
19
+ return "Event" in [child .portal_type for child in children ]
Original file line number Diff line number Diff line change 57
57
</index >
58
58
<index name =" exclude_from_search" meta_type =" BooleanIndex" >
59
59
<indexed_attr value =" exclude_from_search" />
60
- </index >
60
+ </index >
61
+ <index name =" rassegna" meta_type =" BooleanIndex" >
62
+ <indexed_attr value =" rassegna" />
63
+ </index >
61
64
62
65
<!-- metadata -->
63
66
<column value =" tipologia_notizia" />
71
74
<column value =" ente_bando" />
72
75
<column value =" icona" />
73
76
<column value =" update_note" />
77
+ <column value =" rassegna" />
74
78
75
79
<!-- cleanup -->
76
80
<index name =" argomenti_correlati"
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" utf-8" ?>
2
2
<metadata >
3
- <version >7301 </version >
3
+ <version >7303 </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 464
464
<value key =" group" i18n : translate =" " >Metadata</value >
465
465
</records >
466
466
467
+ <records interface =" plone.app.querystring.interfaces.IQueryField"
468
+ prefix =" plone.app.querystring.field.rassegna"
469
+ >
470
+ <value key =" title" i18n : translate =" " >Evento Rassegna</value >
471
+ <value key =" description" i18n : translate =" " >Esclude le rassegne dai listing</value >
472
+ <value key =" enabled" >True</value >
473
+ <value key =" sortable" >False</value >
474
+ <value key =" operations" >
475
+ <element >plone.app.querystring.operation.boolean.isTrue</element >
476
+ <element >plone.app.querystring.operation.boolean.isFalse</element >
477
+ </value >
478
+ <value key =" group" i18n : translate =" " >Metadata</value >
479
+ </records >
480
+
481
+
467
482
468
483
<!-- cleanup -->
469
484
<records interface =" plone.app.querystring.interfaces.IQueryField"
Original file line number Diff line number Diff line change 863
863
destination =" 7301"
864
864
handler =" .to_730x.to_7301"
865
865
/>
866
+ <genericsetup : upgradeStep
867
+ title =" Add new index for event"
868
+ profile =" design.plone.contenttypes:default"
869
+ source =" 7301"
870
+ destination =" 7302"
871
+ handler =" .to_730x.to_7302"
872
+ />
873
+ <genericsetup : upgradeStep
874
+ title =" Add new key to filter listing by rassegna"
875
+ profile =" design.plone.contenttypes:default"
876
+ source =" 7302"
877
+ destination =" 7303"
878
+ handler =" .to_730x.to_7303"
879
+ />
866
880
867
881
</configure >
Original file line number Diff line number Diff line change 11
11
DEFAULT_PROFILE = "profile-design.plone.contenttypes:default"
12
12
13
13
14
+ def update_profile (context , profile , run_dependencies = True ):
15
+ context .runImportStepFromProfile (DEFAULT_PROFILE , profile , run_dependencies )
16
+
17
+
18
+ def update_catalog (context ):
19
+ update_profile (context , "catalog" )
20
+
21
+
22
+ def update_registry (context ):
23
+ update_profile (context , "plone.app.registry" , run_dependencies = False )
24
+
25
+
14
26
def to_7301 (context ):
15
27
brains = api .content .find (portal_type = "Persona" )
16
28
for brain in brains :
@@ -43,3 +55,21 @@ def to_7301(context):
43
55
if api .content .get_state (child ) != "published" :
44
56
with api .env .adopt_roles (["Reviewer" ]):
45
57
api .content .transition (obj = child , transition = "publish" )
58
+
59
+
60
+ def to_7302 (context ):
61
+ update_catalog (context )
62
+ brains = api .content .find (portal_type = "Event" )
63
+ tot = len (brains )
64
+ i = 0
65
+ for brain in brains :
66
+ i += 1
67
+ if i % 100 == 0 :
68
+ logger .info ("Progress: {}/{}" .format (i , tot ))
69
+ event = brain .getObject ()
70
+ event .reindexObject (idxs = ["rassegna" ])
71
+
72
+
73
+ def to_7303 (context ):
74
+ update_registry (context )
75
+ logger .info ("Update registry" )
You can’t perform that action at this time.
0 commit comments