Skip to content

Commit

Permalink
Change get_scales_info to not depend on _IMREALLYPLONE5-hint
Browse files Browse the repository at this point in the history
  • Loading branch information
datakurre committed Jul 7, 2021
1 parent 29c6172 commit b7676cb
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions plone/formwidget/namedfile/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
from zope.interface import Interface
from ZPublisher.HTTPRequest import FileUpload

try:
from Products.CMFPlone.factory import _IMREALLYPLONE5 # noqa
except ImportError:
PLONE_5 = False # pragma: no cover
else:
PLONE_5 = True # pragma: no cover


FILE_UPLOAD_MAP_KEY = "file_upload_map"
FILE_UPLOAD_EXPIRATION_TIME = 30 * 60 # seconds
Expand Down Expand Up @@ -63,16 +56,15 @@ def get_scale_infos():
available image scales.
"""
from Products.CMFCore.interfaces import IPropertiesTool
if PLONE_5:
try:
from plone.registry.interfaces import IRegistry

registry = getUtility(IRegistry)
from Products.CMFPlone.interfaces import IImagingSchema

imaging_settings = registry.forInterface(IImagingSchema, prefix="plone")
allowed_sizes = imaging_settings.allowed_sizes

else:
except ImportError: # Plone 4
ptool = getUtility(IPropertiesTool)
image_properties = ptool.imaging_properties
allowed_sizes = image_properties.getProperty("allowed_sizes")
Expand Down

0 comments on commit b7676cb

Please sign in to comment.