Skip to content

Commit

Permalink
pre_scale: rename variable 'field' to 'value'.
Browse files Browse the repository at this point in the history
That is a more correct name.
  • Loading branch information
mauritsvanrees committed Jul 19, 2022
1 parent 8cde451 commit c4ceb41
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions plone/scale/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,24 +229,24 @@ def pre_scale(self, **parameters):
# There is nothing we can do.
return
fieldname = parameters.get("fieldname", None)
field = scaling_factory.get_original_value(fieldname=fieldname)
if field is None:
# Either an empty field, or the field does not exist.
value = scaling_factory.get_original_value(fieldname=fieldname)
if value is None:
# Either an empty value, or the field does not exist.
return

# There is no info, or it is outdated. Recreate the scale info.
# We need width and height for various reasons.
# Start with a basis.
width = parameters.get("width")
height = parameters.get("height")
orig_width, orig_height = field.getImageSize()
orig_width, orig_height = value.getImageSize()
mode = get_scale_mode(
parameters.get("direction") or parameters.get("mode") or "contain"
)
width, height = calculate_scaled_dimensions(
orig_width, orig_height, width, height, mode
)
mimetype = field.contentType
mimetype = value.contentType
key = self.hash(**parameters)
info = dict(
uid=uid,
Expand Down

0 comments on commit c4ceb41

Please sign in to comment.