Skip to content

Commit

Permalink
Prevent deprecation warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauritsvanrees committed Jan 20, 2025
1 parent 7af9649 commit 366031a
Show file tree
Hide file tree
Showing 35 changed files with 78 additions and 74 deletions.
1 change: 1 addition & 0 deletions news/4090.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Prevent deprecation warnings. @mauritsvanrees
10 changes: 10 additions & 0 deletions src/plone/restapi/bbb.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from plone.base.interfaces import IImagingSchema
from plone.base.interfaces import ILanguage
from plone.base.interfaces import IMailSchema
from plone.base.interfaces import IMigratingPloneSiteRoot
from plone.base.interfaces import INavigationRoot
from plone.base.interfaces import INavigationSchema
from plone.base.interfaces import INonInstallable
from plone.base.interfaces import INonStructuralFolder
Expand All @@ -13,18 +15,25 @@
from plone.base.interfaces import ISecuritySchema
from plone.base.interfaces import ISelectableConstrainTypes
from plone.base.interfaces import ISiteSchema
from plone.base.interfaces import ITestCasePloneSiteRoot
from plone.base.navigationroot import get_navigation_root
from plone.base.utils import base_hasattr
from plone.base.utils import safe_callable
from plone.base.utils import safe_hasattr
from plone.base.utils import safe_text
except ImportError:
# BBB Plone 5.2
from plone.app.layout.navigation.interfaces import INavigationRoot
from plone.app.layout.navigation.root import (
getNavigationRoot as get_navigation_root,
)
from Products.CMFPlone.defaultpage import is_default_page
from Products.CMFPlone.interfaces import IConstrainTypes
from Products.CMFPlone.interfaces import IEditingSchema
from Products.CMFPlone.interfaces import IImagingSchema
from Products.CMFPlone.interfaces import ILanguage
from Products.CMFPlone.interfaces import IMailSchema
from Products.CMFPlone.interfaces import IMigratingPloneSiteRoot
from Products.CMFPlone.interfaces import INavigationSchema
from Products.CMFPlone.interfaces import INonInstallable
from Products.CMFPlone.interfaces import INonStructuralFolder
Expand All @@ -33,6 +42,7 @@
from Products.CMFPlone.interfaces import ISecuritySchema
from Products.CMFPlone.interfaces import ISelectableConstrainTypes
from Products.CMFPlone.interfaces import ISiteSchema
from Products.CMFPlone.interfaces import ITestCasePloneSiteRoot
from Products.CMFPlone.utils import base_hasattr
from Products.CMFPlone.utils import safe_callable
from Products.CMFPlone.utils import safe_hasattr
Expand Down
6 changes: 3 additions & 3 deletions src/plone/restapi/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
title="plone.restapi testing"
description="Adds sample content types for testing"
provides="Products.GenericSetup.interfaces.EXTENSION"
for="Products.CMFPlone.interfaces.ITestCasePloneSiteRoot"
for="plone.restapi.bbb.ITestCasePloneSiteRoot"
directory="profiles/testing"
/>

Expand All @@ -61,7 +61,7 @@
title="plone.restapi testing-workflows"
description="Adds sample workflows for testing"
provides="Products.GenericSetup.interfaces.EXTENSION"
for="Products.CMFPlone.interfaces.ITestCasePloneSiteRoot"
for="plone.restapi.bbb.ITestCasePloneSiteRoot"
directory="profiles/testing-workflows"
/>

Expand Down Expand Up @@ -127,7 +127,7 @@

<utility
factory=".setuphandlers.HiddenProfiles"
provides="Products.CMFPlone.interfaces.INonInstallable"
provides="plone.restapi.bbb.INonInstallable"
name="plone.restapi"
/>

Expand Down
2 changes: 1 addition & 1 deletion src/plone/restapi/profiles/performance/registry.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<registry xmlns:i18n="http://xml.zope.org/namespaces/i18n" i18n:domain="plone">
<!-- Allowed sizes -->
<record name="plone.allowed_sizes" interface="Products.CMFPlone.interfaces.controlpanel.IImagingSchema" field="allowed_sizes">
<record name="plone.allowed_sizes" interface="plone.restapi.bbb.IImagingSchema" field="allowed_sizes">
<value>
<element>icon 32:32</element>
<element>tile 64:64</element>
Expand Down
9 changes: 1 addition & 8 deletions src/plone/restapi/search/handler.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
from plone.registry.interfaces import IRegistry
from plone.restapi.bbb import ISearchSchema
from plone.restapi.bbb import get_navigation_root
from plone.restapi.interfaces import ISerializeToJson
from plone.restapi.interfaces import IZCatalogCompatibleQuery
from Products.CMFCore.utils import getToolByName
from zope.component import getMultiAdapter
from zope.component import getUtility


try:
from plone.base.navigationroot import get_navigation_root
except ImportError:
from plone.app.layout.navigation.root import (
getNavigationRoot as get_navigation_root,
)


class SearchHandler:
"""Executes a catalog search based on a query dict, and returns
JSON compatible results.
Expand Down
2 changes: 1 addition & 1 deletion src/plone/restapi/serializer/dxcontent.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from plone.dexterity.interfaces import IDexterityContent
from plone.dexterity.utils import iterSchemata
from plone.restapi.batching import HypermediaBatch
from plone.restapi.bbb import base_hasattr
from plone.restapi.deserializer import boolean_value
from plone.restapi.interfaces import IFieldSerializer
from plone.restapi.interfaces import IObjectPrimaryFieldTarget
Expand All @@ -21,7 +22,6 @@
from plone.rfc822.interfaces import IPrimaryFieldInfo
from plone.supermodel.utils import mergedTaggedValueDict
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.utils import base_hasattr
from Products.CMFCore.interfaces import IContentish
from zope.component import adapter
from zope.component import ComponentLookupError
Expand Down
2 changes: 1 addition & 1 deletion src/plone/restapi/services/addons/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<plone:service
method="POST"
factory=".post.AddonsPost"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="cmf.ManagePortal"
name="@addons"
/>
Expand Down
8 changes: 4 additions & 4 deletions src/plone/restapi/services/aliases/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
method="GET"
accept="application/json,application/schema+json"
factory=".get.AliasesGet"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="Products.CMFPlone.ManagePortalAliases"
name="@aliases"
/>
Expand All @@ -16,7 +16,7 @@
method="GET"
accept="text/csv"
factory=".get.AliasesGet"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="Products.CMFPlone.ManagePortalAliases"
name="@aliases"
/>
Expand All @@ -41,7 +41,7 @@
<plone:service
method="POST"
factory=".add.AliasesRootPost"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="Products.CMFPlone.ManagePortalAliases"
name="@aliases"
/>
Expand All @@ -57,7 +57,7 @@
<plone:service
method="DELETE"
factory=".delete.AliasesDelete"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="Products.CMFPlone.ManagePortalAliases"
name="@aliases"
/>
Expand Down
6 changes: 3 additions & 3 deletions src/plone/restapi/services/auth/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
<plone:service
method="POST"
factory=".login.Login"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="zope.Public"
name="@login"
/>

<plone:service
method="POST"
factory=".logout.Logout"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="zope.Public"
name="@logout"
/>

<plone:service
method="POST"
factory=".renew.Renew"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="zope.Public"
name="@login-renew"
/>
Expand Down
12 changes: 6 additions & 6 deletions src/plone/restapi/services/content/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<plone:service
method="GET"
factory=".get.ContentGet"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="zope2.View"
/>

Expand All @@ -27,7 +27,7 @@
<plone:service
method="PATCH"
factory=".update.ContentPatch"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="cmf.ModifyPortalContent"
/>

Expand Down Expand Up @@ -55,7 +55,7 @@
<plone:service
method="GET"
factory=".sharing.SharingGet"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="zope2.View"
name="@sharing"
/>
Expand All @@ -71,7 +71,7 @@
<plone:service
method="POST"
factory=".sharing.SharingPost"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="zope2.View"
name="@sharing"
/>
Expand Down Expand Up @@ -119,7 +119,7 @@
<plone:service
method="HEAD"
factory=".tus.UploadHead"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="cmf.AddPortalContent"
name="@tus-upload"
/>
Expand All @@ -135,7 +135,7 @@
<plone:service
method="PATCH"
factory=".tus.UploadPatch"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="cmf.AddPortalContent"
name="@tus-upload"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/plone/restapi/services/content/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from DateTime import DateTime
from plone.app.content.interfaces import INameFromTitle
from plone.app.uuid.utils import uuidToObject
from plone.restapi.bbb import base_hasattr
from plone.uuid.interfaces import IUUID
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.utils import base_hasattr
from random import randint
from zExceptions import Unauthorized
from zope.component import getUtility
Expand Down
10 changes: 5 additions & 5 deletions src/plone/restapi/services/contextnavigation/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
from Acquisition import aq_parent
from collections import UserDict
from plone import api
from plone.app.layout.navigation.interfaces import INavigationRoot
from plone.app.layout.navigation.navtree import buildFolderTree
from plone.app.layout.navigation.root import getNavigationRoot
from plone.restapi.bbb import get_navigation_root
from plone.i18n.normalizer.interfaces import IIDNormalizer
from plone.memoize.instance import memoize
from plone.registry.interfaces import IRegistry
from plone.restapi.bbb import INavigationRoot
from plone.restapi.bbb import INavigationSchema
from plone.restapi.bbb import INonStructuralFolder
from plone.restapi.bbb import is_default_page
Expand Down Expand Up @@ -353,7 +353,7 @@ def getMimeTypeIcon(self, node):
if not node["normalized_portal_type"] == "file":
return
fileo = node["item"].getObject().file
portal_url = getNavigationRoot(self.context)
portal_url = get_navigation_root(self.context)
mtt = getToolByName(self.context, "mimetypes_registry")
if fileo.contentType:
ctype = mtt.lookup(fileo.contentType)
Expand Down Expand Up @@ -562,7 +562,7 @@ def getRootPath(context, currentFolderOnly, topLevel, root_path):
if root is not None:
rootPath = "/".join(root.getPhysicalPath())
else:
rootPath = getNavigationRoot(context)
rootPath = get_navigation_root(context)

# Adjust for topLevel
if topLevel > 0:
Expand Down Expand Up @@ -637,7 +637,7 @@ def __init__(self, context, data):
if root is not None:
rootPath = "/".join(root.getPhysicalPath())
else:
rootPath = getNavigationRoot(context)
rootPath = get_navigation_root(context)

currentPath = "/".join(context.getPhysicalPath())

Expand Down
8 changes: 4 additions & 4 deletions src/plone/restapi/services/controlpanels/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,31 @@
<plone:service
method="POST"
factory=".add.ControlpanelsAdd"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="plone.app.controlpanel.Overview"
name="@controlpanels"
/>

<plone:service
method="GET"
factory=".get.ControlpanelsGet"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="plone.app.controlpanel.Overview"
name="@controlpanels"
/>

<plone:service
method="PATCH"
factory=".update.ControlpanelsUpdate"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="plone.app.controlpanel.Overview"
name="@controlpanels"
/>

<plone:service
method="DELETE"
factory=".delete.ControlpanelsDelete"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="plone.app.controlpanel.Overview"
name="@controlpanels"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/plone/restapi/services/database/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<plone:service
method="GET"
factory=".get.DatabaseGet"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="plone.app.controlpanel.Overview"
name="@database"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/plone/restapi/services/linkintegrity/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<plone:service
method="GET"
factory=".get.LinkIntegrityGet"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="zope2.AccessContentsInformation"
name="@linkintegrity"
/>
Expand Down
8 changes: 4 additions & 4 deletions src/plone/restapi/services/locking/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<plone:service
method="GET"
factory=".get.Lock"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="zope2.View"
name="@lock"
/>
Expand All @@ -30,7 +30,7 @@
<plone:service
method="POST"
factory=".add.Lock"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="cmf.ModifyPortalContent"
name="@lock"
/>
Expand All @@ -46,7 +46,7 @@
<plone:service
method="PATCH"
factory=".update.Lock"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="cmf.ModifyPortalContent"
name="@lock"
/>
Expand All @@ -62,7 +62,7 @@
<plone:service
method="DELETE"
factory=".delete.Lock"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.restapi.bbb.IPloneSiteRoot"
permission="cmf.ModifyPortalContent"
name="@lock"
/>
Expand Down
Loading

0 comments on commit 366031a

Please sign in to comment.