Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python3 #29

Merged
merged 8 commits into from
Aug 2, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ New features:

Bug fixes:

- *add item here*


1.2.12 (unreleased)
-------------------

Bug fixes:

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petschki looks like the merge left some garbage behind - 2x unreleased?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, I'd suggest to release my fix in 1.2.12 and update the release date later for 1.3.0 changelog

- purge transform cache when a uid referenced image
gets updated. this fixes `issue CMFPLone#2465 <https://github.com/plone/Products.CMFPlone/issues/2465>`_
[petschki]
Expand Down
12 changes: 8 additions & 4 deletions plone/app/textfield/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from zope.interface import implementer

import logging
import re
import six


LOG = logging.getLogger('plone.app.textfield')
imguid_re = re.compile(r'src="[^/]*/resolve[uU]id/([^/"]*)')

Expand Down Expand Up @@ -45,9 +45,13 @@ def __call__(self, value, mimeType):
if six.PY2:
# in Python 2 transforms expect str
source_value = value.raw_encoded
else:# in Python 3 we pass text
else:
# in Python 3 we pass text
source_value = value.raw

# check for modified referenced images
self.check_referenced_images(source_value, mimeType, value._raw_holder)

try:
data = transforms.convertTo(mimeType,
source_value,
Expand Down Expand Up @@ -82,7 +86,7 @@ def __call__(self, value, mimeType):
LOG.error("Transform exception", exc_info=True)
raise TransformError('Error during transformation', e)

def check_referenced_images(self, target_mimetype, cache_obj):
def check_referenced_images(self, value, target_mimetype, cache_obj):
# check catalog counter for changes first.
counter = self.catalog.getCounter()
cached_counter = getattr(cache_obj, self._ccounter_id, -1)
Expand All @@ -93,7 +97,7 @@ def check_referenced_images(self, target_mimetype, cache_obj):
setattr(cache_obj, self._ccounter_id, counter)

# extract all image src uuids
uids = imguid_re.findall(cache_obj.value)
uids = imguid_re.findall(value)
if len(uids) == 0:
# no uuid here at all
return
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.