Skip to content

Commit

Permalink
Merge pull request #75 from plone/4126-replace-pkg-resources
Browse files Browse the repository at this point in the history
Replace pkg_resources
  • Loading branch information
gforcada authored Mar 1, 2025
2 parents e5b06bf + eeeec82 commit e563170
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions news/4126.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replace `pkg_resources` with `importlib.metadata` @gforcada
7 changes: 4 additions & 3 deletions plone/app/contentmenu/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from Acquisition import aq_inner
from Acquisition import aq_parent
from html import escape
from importlib.metadata import distribution
from importlib.metadata import PackageNotFoundError
from operator import itemgetter
from plone.app.content.browser.folderfactories import _allowedTypes
from plone.app.contentmenu import PloneMessageFactory as _
Expand Down Expand Up @@ -37,16 +39,15 @@
from zope.interface import implementer

import json
import pkg_resources
import plone.locking # noqa: F401


PMF = _ # used for dynamic messages we don't want to extract

try:
pkg_resources.get_distribution("Products.CMFPlacefulWorkflow")
distribution("Products.CMFPlacefulWorkflow")
from Products.CMFPlacefulWorkflow.permissions import ManageWorkflowPolicies
except pkg_resources.DistributionNotFound:
except PackageNotFoundError:
from Products.CMFCore.permissions import ManagePortal as ManageWorkflowPolicies


Expand Down

0 comments on commit e563170

Please sign in to comment.