-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* aggiunto la cartella altri allegati sulla persona * add some fix in order to work with plone 6.0.11 and it's dependencies
- Loading branch information
1 parent
99b6ba6
commit 5ff1087
Showing
10 changed files
with
85 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# -*- coding: utf-8 -*- | ||
from design.plone.contenttypes.utils import create_default_blocks | ||
from plone import api | ||
from Products.CMFPlone.interfaces import ISelectableConstrainTypes | ||
|
||
import logging | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
|
||
DEFAULT_PROFILE = "profile-design.plone.contenttypes:default" | ||
|
||
|
||
def to_7301(context): | ||
brains = api.content.find(portal_type="Persona") | ||
for brain in brains: | ||
persona = brain.getObject() | ||
FOLDER_ID = "altri-documenti" | ||
if FOLDER_ID not in persona.keys(): | ||
child = api.content.create( | ||
container=persona, | ||
type="Document", | ||
title="Altri documenti", | ||
id=FOLDER_ID, | ||
) | ||
create_default_blocks(context=child) | ||
else: | ||
child = persona[FOLDER_ID] | ||
|
||
child.exclude_from_search = True | ||
child.reindexObject(idxs=["exclude_from_search"]) | ||
# select constraints | ||
constraintsChild = ISelectableConstrainTypes(child) | ||
constraintsChild.setConstrainTypesMode(1) | ||
constraintsChild.setLocallyAllowedTypes( | ||
( | ||
"File", | ||
"Image", | ||
"Link", | ||
) | ||
) | ||
if api.content.get_state(persona) == "published": | ||
if api.content.get_state(child) != "published": | ||
with api.env.adopt_roles(["Reviewer"]): | ||
api.content.transition(obj=child, transition="publish") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters