Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Changelog

- Avoid showing items inside cartella modulistica if omitted from navigation.
[daniele]

- Add linkintegrity support for canale_digitale_link field in Servizio CT.
[cekk]

6.3.14 (2025-10-31)
-------------------
Expand Down
2 changes: 1 addition & 1 deletion src/design/plone/contenttypes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""Init and utils."""

from collective.address.behaviors import IAddress
from plone.app.dexterity.textindexer import utils
from zope.i18nmessageid import MessageFactory


_ = MessageFactory("design.plone.contenttypes")


Expand Down
3 changes: 3 additions & 0 deletions src/design/plone/contenttypes/adapters/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@

<adapter factory=".query.ZCatalogCompatibleQueryAdapter" />

<!-- link integrity retriever -->
<adapter factory=".linkintegrity_retriever.ServizioCanaleDigitaleRetriever" />

</configure>
24 changes: 24 additions & 0 deletions src/design/plone/contenttypes/adapters/linkintegrity_retriever.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Link Integrity - link retriever methods."""

from design.plone.contenttypes.interfaces.servizio import IServizio
from plone.app.linkintegrity.interfaces import IRetriever
from zope.component import adapter
from zope.interface import implementer


@implementer(IRetriever)
@adapter(IServizio)
class ServizioCanaleDigitaleRetriever:
""""""

def __init__(self, context):
self.context = context

def retrieveLinks(self):
"""
If canale_digitale_link refers to an internal object, enable linkintegrity
"""
canale_digitale_link = getattr(self.context, "canale_digitale_link", None)
if canale_digitale_link and "resolveuid" in canale_digitale_link:
return [canale_digitale_link]
return []
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import json


logger = getLogger(__name__)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import io


FLAG = '<i class="fa-solid fa-check"></i>'


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import io


FLAG = '<i class="fa-solid fa-check"></i>'


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import io


FLAG = '<i class="fa-solid fa-check"></i>'


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import io
import transaction


FLAG = '<i class="fa-solid fa-check"></i>'


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from zope.security import checkPermission
from zc.relation.interfaces import ICatalog


FLAG = '<i class="fa-solid fa-check"></i>'


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from Products.Five import BrowserView
import io


FLAG = '<i class="fa-solid fa-check"></i>'


Expand Down
1 change: 0 additions & 1 deletion src/design/plone/contenttypes/browser/utils/check_uo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import io


FLAG = '<i class="fa-solid fa-check"></i>'


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import pkg_resources
import time


JS_TEMPLATE = (
"{portal_url}/++plone++design.plone.contenttypes/js/{name}.js?v={version}" # noqa
)
Expand Down
1 change: 0 additions & 1 deletion src/design/plone/contenttypes/events/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from plone import api
from Products.CMFPlone.interfaces import ISelectableConstrainTypes


SUBFOLDERS_MAPPING = {
"Bando": {
"content": [
Expand Down
1 change: 0 additions & 1 deletion src/design/plone/contenttypes/indexers/pagina_argomento.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from zope.component import adapter
from zope.interface import implementer


HAVE_REST_API_PRE_961 = False

try:
Expand Down
1 change: 1 addition & 0 deletions src/design/plone/contenttypes/interfaces/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
"""Module where all interfaces, events and exceptions live."""

from redturtle.volto.interfaces import IRedturtleVoltoLayer
from redturtle.bandi.interfaces.browserlayer import IRedturtleBandiLayer
from zope.interface import Interface
Expand Down
1 change: 0 additions & 1 deletion src/design/plone/contenttypes/interfaces/persona.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from z3c.relationfield.schema import RelationChoice
from z3c.relationfield.schema import RelationList


# TODO: migration script for these commented fields towards PDC
# telefono
# fax
Expand Down
1 change: 0 additions & 1 deletion src/design/plone/contenttypes/locales/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import pkg_resources
import subprocess


domain = "design.plone.contenttypes"
os.chdir(pkg_resources.resource_filename(domain, ""))
os.chdir("../../../../")
Expand Down
1 change: 0 additions & 1 deletion src/design/plone/contenttypes/patches/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import logging


logger = logging.getLogger("design.plone.contenttypes.patches")

logger.info("Patching plone.restapi.serializer.dxcontent.SerializeToJson._call__")
Expand Down
1 change: 0 additions & 1 deletion src/design/plone/contenttypes/patches/baseserializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from zope.component import queryUtility
from zope.i18n import translate


original_serialize_to_json__call__ = SerializeToJson.__call__


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<version>7315</version>
<version>7320</version>
<dependencies>
<dependency>profile-redturtle.bandi:default</dependency>
<dependency>profile-collective.venue:default</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from zope.interface import implementer
from zope.interface import Interface


TITLE_MAX_LEN = 255
DESCRIPTION_MAX_LEN = 255
EMPTY_BLOCK_MARKER = {"@type": "text"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import json


KEYS_WITH_URL = ["linkUrl", "navigationRoot", "showMoreLink"]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from zope.interface import implementer
from zope.interface import Interface


TITLE_MAX_LEN = 255
DESCRIPTION_MAX_LEN = 255
EMPTY_BLOCK_MARKER = {"@type": "text"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from zope.interface import implementer
from zope.interface import Interface


TITLE_MAX_LEN = 255
DESCRIPTION_MAX_LEN = 255
EMPTY_BLOCK_MARKER = {"@type": "text"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from zope.interface import implementer
from zope.interface import Interface


TITLE_MAX_LEN = 255
DESCRIPTION_MAX_LEN = 255
EMPTY_BLOCK_MARKER = {"@type": "text"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from zope.interface import implementer
from zope.interface import Interface


TITLE_MAX_LEN = 255
DESCRIPTION_MAX_LEN = 255
EMPTY_BLOCK_MARKER = {"@type": "text"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import json
import re


RESOLVEUID_RE = re.compile(".*?/resolve[Uu]id/([^/]*)/?(.*)$")
KEYS_WITH_URL = ["linkUrl", "navigationRoot", "showMoreLink"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import logging
import re


RESOLVEUID_RE = re.compile(".*?/resolve[Uu]id/([^/]*)/?(.*)$")
logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import logging


logger = logging.getLogger(__name__)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from zope.component import getMultiAdapter
from zope.component import queryMultiAdapter


zcatalog_version = get_distribution("Products.ZCatalog").version
if parse_version(zcatalog_version) >= parse_version("5.1"):
SUPPORT_NOT_UUID_QUERIES = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from zope.interface import implementer
from zope.interface import Interface


TRASPARENZA_FIELDS = [
"modalita_avvio",
"descrizione",
Expand Down
1 change: 0 additions & 1 deletion src/design/plone/contenttypes/restapi/types/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from zope.schema.interfaces import ITextLine
from zope.schema.interfaces import IVocabularyFactory


DATAGRID_FIELDS = ["value_punto_contatto", "timeline_tempi_scadenze"]


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

"""Setup tests for this package."""

from design.plone.contenttypes.testing import (
DESIGN_PLONE_CONTENTTYPES_API_FUNCTIONAL_TESTING,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

"""Setup tests for this package."""

from design.plone.contenttypes.testing import (
DESIGN_PLONE_CONTENTTYPES_API_FUNCTIONAL_TESTING,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

"""Setup tests for this package."""

from design.plone.contenttypes.controlpanels.settings import IDesignPloneSettings
from design.plone.contenttypes.testing import (
DESIGN_PLONE_CONTENTTYPES_API_FUNCTIONAL_TESTING,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

"""Setup tests for this package."""

from design.plone.contenttypes.testing import (
DESIGN_PLONE_CONTENTTYPES_API_FUNCTIONAL_TESTING,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
"""Setup tests for this package."""

from design.plone.contenttypes.testing import (
DESIGN_PLONE_CONTENTTYPES_API_FUNCTIONAL_TESTING,
)
Expand Down
36 changes: 35 additions & 1 deletion src/design/plone/contenttypes/tests/test_ct_servizio.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# -*- coding: utf-8 -*-
"""Setup tests for this package."""

from design.plone.contenttypes.testing import (
DESIGN_PLONE_CONTENTTYPES_API_FUNCTIONAL_TESTING,
)
from plone import api
from plone.app.linkintegrity.utils import getIncomingLinks
from plone.app.linkintegrity.utils import getOutgoingLinks
from plone.app.testing import setRoles
from plone.app.testing import SITE_OWNER_NAME
from plone.app.testing import SITE_OWNER_PASSWORD
Expand All @@ -13,7 +16,6 @@

import unittest


WIDGET_PROPERTY_CHECKS = {
"tassonomia_argomenti": {
"selectableTypes": ["Pagina Argomento"],
Expand Down Expand Up @@ -338,6 +340,38 @@ def test_servizio_fields_seo_fieldset(self):
],
)

def test_canale_digitale_link_to_object_generate_reference(self):
doc = api.content.create(container=self.portal, type="Document", title="doc")

self.assertEqual(len(list(getIncomingLinks(doc))), 0)

servizio = api.content.create(
container=self.portal,
type="Servizio",
title="servizio",
canale_digitale_link=f"${{portal_url}}/resolveuid/{doc.UID()}",
)
self.assertEqual(len(list(getIncomingLinks(doc))), 1)
self.assertEqual([x.from_object for x in getIncomingLinks(doc)], [servizio])

self.assertEqual(len(list(getOutgoingLinks(servizio))), 1)
self.assertEqual([x.to_object for x in getOutgoingLinks(servizio)], [doc])

def test_canale_digitale_link_to_external_do_not_generate_reference(self):
doc = api.content.create(container=self.portal, type="Document", title="doc")

self.assertEqual(len(list(getIncomingLinks(doc))), 0)

servizio = api.content.create(
container=self.portal,
type="Servizio",
title="servizio",
canale_digitale_link="https://www.plone.org",
)
self.assertEqual(len(list(getIncomingLinks(doc))), 0)

self.assertEqual(len(list(getOutgoingLinks(servizio))), 0)


class TestServizioApi(unittest.TestCase):
"""Test that design.plone.contenttypes is properly installed."""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

"""Setup tests for this package."""

from design.plone.contenttypes.testing import (
DESIGN_PLONE_CONTENTTYPES_API_FUNCTIONAL_TESTING,
)
Expand Down
Loading