Skip to content

Commit

Permalink
Fix DeprecationWarnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauritsvanrees committed Jan 20, 2025
1 parent 13a9f56 commit 3e9af53
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 18 deletions.
1 change: 1 addition & 0 deletions news/4090.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix DeprecationWarnings. [maurits]
2 changes: 1 addition & 1 deletion plone/app/portlets/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@

<browser:page
name="manage-dashboard"
for="plone.app.layout.navigation.interfaces.INavigationRoot"
for="plone.base.interfaces.INavigationRoot"
class=".manage.ManageDashboardPortlets"
template="templates/manage-dashboard.pt"
permission="plone.app.portlets.ManageOwnPortlets"
Expand Down
4 changes: 2 additions & 2 deletions plone/app/portlets/dashboard/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<browser:page
name="dashboard"
for="plone.app.layout.navigation.interfaces.INavigationRoot"
for="plone.base.interfaces.INavigationRoot"
class=".dashboard.DashboardView"
template="dashboard.pt"
permission="plone.app.portlets.ViewDashboard"
Expand All @@ -15,7 +15,7 @@
It has been placed here to be near the personal bar code -->
<browser:page
name="useractions"
for="plone.app.layout.navigation.interfaces.INavigationRoot"
for="plone.base.interfaces.INavigationRoot"
class=".user_actions.UserActionsView"
template="user_actions.pt"
permission="zope2.View"
Expand Down
12 changes: 6 additions & 6 deletions plone/app/portlets/portlets/navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
from Acquisition import aq_parent
from ComputedAttribute import ComputedAttribute
from plone.app.layout.navigation.interfaces import INavigationQueryBuilder
from plone.app.layout.navigation.interfaces import INavigationRoot
from plone.app.layout.navigation.interfaces import INavtreeStrategy
from plone.app.layout.navigation.navtree import buildFolderTree
from plone.app.layout.navigation.root import getNavigationRoot
from plone.app.layout.navigation.root import getNavigationRootObject
from plone.app.uuid.utils import uuidToObject
from plone.app.vocabularies.catalog import CatalogSource
from plone.base.defaultpage import is_default_page
from plone.base.interfaces import INavigationRoot
from plone.base.interfaces import INavigationSchema
from plone.base.interfaces import INonStructuralFolder
from plone.base.interfaces import ISiteSchema
from plone.base.navigationroot import get_navigation_root
from plone.base.navigationroot import get_navigation_root_object
from plone.base.utils import safe_callable
from plone.i18n.normalizer.interfaces import IIDNormalizer
from plone.memoize.instance import memoize
Expand Down Expand Up @@ -197,7 +197,7 @@ def _root(self):
if not root:
return None
portal = getToolByName(self, "portal_url").getPortalObject()
navroot = getNavigationRootObject(self, portal)
navroot = get_navigation_root_object(self, portal)
try:
root = navroot.unrestrictedTraverse(root.lstrip("/"))
except (AttributeError, KeyError, TypeError, NotFound):
Expand Down Expand Up @@ -418,7 +418,7 @@ def __init__(self, context, portlet):
if root is not None:
rootPath = "/".join(root.getPhysicalPath())
else:
rootPath = getNavigationRoot(context)
rootPath = get_navigation_root(context)
currentPath = "/".join(context.getPhysicalPath())

# If we are above the navigation root, a navtree query would return
Expand Down Expand Up @@ -500,7 +500,7 @@ def getRootPath(context, currentFolderOnly, topLevel, root):
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
8 changes: 4 additions & 4 deletions plone/app/portlets/portlets/news.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from ..cache import render_cachekey
from ..portlets import base
from Acquisition import aq_inner
from plone.app.layout.navigation.root import getNavigationRootObject
from plone.app.z3cform.widget import SelectFieldWidget
from plone.app.z3cform.widgets.select import Select2FieldWidget
from plone.autoform.directives import widget
from plone.base.interfaces import ISiteSchema
from plone.base.navigationroot import get_navigation_root_object
from plone.memoize import ram
from plone.memoize.compress import xhtml_compress
from plone.memoize.instance import memoize
Expand All @@ -28,7 +28,7 @@ class INewsPortlet(IPortletDataProvider):
min=1,
)

widget(state=SelectFieldWidget)
widget(state=Select2FieldWidget)
state = schema.Tuple(
title=_("Workflow state"),
description=_("Items in which workflow state to show."),
Expand Down Expand Up @@ -98,7 +98,7 @@ def all_news_link(self):
(context, self.request), name="plone_portal_state"
)
portal = portal_state.portal()
if "news" in getNavigationRootObject(context, portal).objectIds():
if "news" in get_navigation_root_object(context, portal).objectIds():
return "%s/news" % portal_state.navigation_root_url()
return None

Expand Down
4 changes: 2 additions & 2 deletions plone/app/portlets/portlets/recent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from ..cache import render_cachekey
from ..portlets import base
from Acquisition import aq_inner
from plone.app.layout.navigation.root import getNavigationRoot
from plone.base.interfaces.controlpanel import ISiteSchema
from plone.base.navigationroot import get_navigation_root
from plone.memoize import ram
from plone.memoize.compress import xhtml_compress
from plone.memoize.instance import memoize
Expand Down Expand Up @@ -145,7 +145,7 @@ def thumb_scale(self):

def getMimeTypeIcon(self, obj):
fileo = obj.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
4 changes: 2 additions & 2 deletions plone/app/portlets/portlets/search.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .. import PloneMessageFactory as _
from ..portlets import base
from plone.app.layout.navigation.root import getNavigationRoot
from plone.base.navigationroot import get_navigation_root
from plone.portlets.interfaces import IPortletDataProvider
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from zope import schema
Expand Down Expand Up @@ -51,7 +51,7 @@ def search_action(self):
return f"{self.navigation_root_url}/{self.action}"

def navigation_root_url(self):
return getNavigationRoot(self.context)
return get_navigation_root(self.context)


class AddForm(base.AddForm):
Expand Down
2 changes: 1 addition & 1 deletion plone/app/portlets/tests/test_navigation_portlet.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from five.intid.intid import IntIds
from five.intid.site import addUtility
from plone.app.layout.navigation.interfaces import INavigationRoot
from plone.app.portlets.portlets import navigation
from plone.app.portlets.storage import PortletAssignmentMapping
from plone.app.portlets.tests.base import PortletsTestCase
from plone.app.testing import setRoles
from plone.app.testing import TEST_USER_ID
from plone.base.interfaces import INavigationRoot
from plone.base.interfaces import INavigationSchema
from plone.portlets.interfaces import IPortletAssignment
from plone.portlets.interfaces import IPortletDataProvider
Expand Down

0 comments on commit 3e9af53

Please sign in to comment.