File tree Expand file tree Collapse file tree 13 files changed +98
-4
lines changed
src/design/plone/ctgeneric/upgrades Expand file tree Collapse file tree 13 files changed +98
-4
lines changed Original file line number Diff line number Diff line change 19
19
python-version : ${{ matrix.python-version }}
20
20
21
21
# python cache
22
- - uses : actions/cache@v1
22
+ - uses : actions/cache@v3
23
23
with :
24
24
path : ~/.cache/pip
25
25
key : ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
Original file line number Diff line number Diff line change 19
19
python-version : ${{ matrix.python-version }}
20
20
21
21
# python cache
22
- - uses : actions/cache@v1
22
+ - uses : actions/cache@v3
23
23
with :
24
24
path : ~/.cache/pip
25
25
key : ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
Original file line number Diff line number Diff line change 19
19
python-version : ${{ matrix.python-version }}
20
20
21
21
# python cache
22
- - uses : actions/cache@v1
22
+ - uses : actions/cache@v3
23
23
with :
24
24
path : ~/.cache/pip
25
25
key : ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
Original file line number Diff line number Diff line change 19
19
python-version : ${{ matrix.python-version }}
20
20
21
21
# python cache
22
- - uses : actions/cache@v1
22
+ - uses : actions/cache@v3
23
23
with :
24
24
path : ~/.cache/pip
25
25
key : ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
Original file line number Diff line number Diff line change
1
+ <configure xmlns =" http://namespaces.zope.org/zope"
2
+ xmlns : gs =" http://namespaces.zope.org/genericsetup" >
3
+
4
+ <gs : registerProfile name =" 1001"
5
+ title =" Enable tipologia_notizia criteria"
6
+ directory =" 1001"
7
+ description =' Configuration for version 1001'
8
+ for =" Products.CMFPlone.interfaces.IMigratingPloneSiteRoot"
9
+ provides =" Products.GenericSetup.interfaces.EXTENSION" />
10
+
11
+ <gs : upgradeSteps source =" 1000"
12
+ destination =" 1001"
13
+ profile =" design.plone.ctgeneric:default" >
14
+
15
+ <gs : upgradeStep title =" Enable tipologia_notizia criteria and reindex"
16
+ description =" "
17
+ handler =" .v1001.upgrade" />
18
+
19
+ </gs : upgradeSteps >
20
+
21
+ </configure >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <object name =" portal_catalog" >
3
+
4
+ <column value =" tipologia_notizia" /><index name =" tipologia_notizia" meta_type =" FieldIndex" >
5
+ <indexed_attr value =" tipologia_notizia" />
6
+ </index >
7
+ </object >
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" i18n : domain =" plone" >
3
+ <!-- redefine tipologia_notizia criteria to not use taxonomy -->
4
+ <records interface =" plone.app.querystring.interfaces.IQueryField" prefix =" plone.app.querystring.field.tipologia_notizia" >
5
+ <value key =" title" i18n : translate =" " >Tipologia notizia</value >
6
+ <value key =" description" i18n : translate =" " >Tipologia della notizia</value >
7
+ <value key =" enabled" >True</value >
8
+ <value key =" sortable" >False</value >
9
+ <value key =" operations" >
10
+ <element >plone.app.querystring.operation.selection.any</element >
11
+ <element >plone.app.querystring.operation.selection.all</element >
12
+ </value >
13
+ <value key =" vocabulary" >design.plone.vocabularies.tipologie_notizia</value >
14
+ <value key =" group" i18n : translate =" " >Metadata</value >
15
+ </records >
16
+
17
+ </registry >
Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*
2
+
3
+ import logging
4
+
5
+
6
+ logger = logging .getLogger ("design.plone.ctgeneric" )
Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+ from plone .app .upgrade .utils import loadMigrationProfile
3
+
4
+
5
+ def reload_gs_profile (context ):
6
+ loadMigrationProfile (
7
+ context ,
8
+ "profile-design.plone.ctgeneric:default" ,
9
+ )
Original file line number Diff line number Diff line change
1
+ <configure
2
+ xmlns =" http://namespaces.zope.org/zope"
3
+ i18n_domain =" design.plone.ctgeneric" >
4
+
5
+ <!-- -*- extra stuff goes here -*- -->
6
+
7
+ <include file =" 1001.zcml" />
8
+
9
+ </configure >
Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+ from design .plone .ctgeneric .setuphandlers import delete_tipologia_notizia_taxonomy
3
+ from plone import api
4
+
5
+ import logging
6
+
7
+ logger = logging .getLogger (__name__ )
8
+
9
+
10
+ def upgrade (setup_tool = None ):
11
+ """ """
12
+ delete_tipologia_notizia_taxonomy ()
13
+
14
+ setup_tool .runAllImportStepsFromProfile ("design.plone.ctgeneric.upgrades:1001" )
15
+
16
+ brains = api .content .find (portal_type = "News Item" )
17
+ tot = len (brains )
18
+ i = 0
19
+ for brain in brains :
20
+ i += 1
21
+ if i % 100 == 0 :
22
+ logger .info (f"Processing { i } of { tot } " )
23
+ obj = brain .getObject ()
24
+ if getattr (obj , "tipologia_notizia" , "" ):
25
+ obj .reindexObject (idxs = ["tipologia_notizia" ])
You can’t perform that action at this time.
0 commit comments