diff --git a/news/4126.internal.rst b/news/4126.internal.rst new file mode 100644 index 000000000..f7c701d92 --- /dev/null +++ b/news/4126.internal.rst @@ -0,0 +1 @@ +Drop use of ``pkg_resources`` in code. [maurits] diff --git a/src/plone/app/mosaic/browser/main_template.py b/src/plone/app/mosaic/browser/main_template.py index 1590a78b5..00b152769 100644 --- a/src/plone/app/mosaic/browser/main_template.py +++ b/src/plone/app/mosaic/browser/main_template.py @@ -1,4 +1,5 @@ from hashlib import md5 +from importlib.resources import files from lxml import etree from lxml import html from plone.app.blocks.interfaces import IBlocksTransformEnabled @@ -21,7 +22,6 @@ import logging import os -import pkg_resources import re @@ -205,13 +205,13 @@ def __repr__(self): def resolve_ajax_main_template(): main_template = os.path.join("browser", "templates", "ajax_main_template.pt") - filename = pkg_resources.resource_filename("Products.CMFPlone", main_template) + filename = files("Products.CMFPlone") / main_template return ViewPageTemplateFile(filename) def resolve_main_template(): main_template = os.path.join("browser", "templates", "main_template.pt") - filename = pkg_resources.resource_filename("Products.CMFPlone", main_template) + filename = files("Products.CMFPlone") / main_template return ViewPageTemplateFile(filename)