Skip to content

Commit

Permalink
some fixed for 4.1 compatability
Browse files Browse the repository at this point in the history
  • Loading branch information
djay committed Dec 19, 2013
1 parent c4ff021 commit 9a276e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
8 changes: 0 additions & 8 deletions Products/EasyNewsletter/content/ENLIssue.py
Expand Up @@ -401,14 +401,6 @@ def send(self, recipients=[]):
for image_url in image_urls:
try:
image_url = urlparse(image_url)[2]
#if 'resolveuid' in image_url:
# urlparts = image_url.split('/')[1:]
# uuid = urlparts.pop(0)
# o = reference_tool.lookupObject(uuid)
# if o and urlparts:
# # get thumb
# o = o.restrictedTraverse(urlparts[0])
#el
if "@@images" in image_url:
# HACK to get around restrictedTraverse not honoring ITraversable
# see http://developer.plone.org/serving/traversing.html#traversing-by-full-path
Expand Down
11 changes: 9 additions & 2 deletions Products/EasyNewsletter/tests/test_newsletter.py
Expand Up @@ -3,7 +3,7 @@
import unittest2 as unittest

#from zope.component import createObject
from zope.component import getMultiAdapter
from zope.component import getMultiAdapter, queryUtility
#from zope.component import queryUtility
from zope.component import getSiteManager

Expand All @@ -18,6 +18,7 @@

from Products.EasyNewsletter.interfaces import IEasyNewsletter, IENLIssue
import os
from Products.TinyMCE.interfaces.utility import ITinyMCE

GLOBALS = globals()
TESTS_HOME = package_home(GLOBALS)
Expand Down Expand Up @@ -128,6 +129,9 @@ def test_send_test_issue_with_scale_image(self):
self.assertIn('Content-ID: <image_1>\nContent-Type: image/png;', msg)

def test_send_test_issue_with_resolveuid_image(self):
# for plone < 4.2 we need to ensure turn on to resolveuid links
tinymce = queryUtility(ITinyMCE)
tinymce.link_using_uids = True

body = '<img src="../../resolveuid/%s"/>' % self.image.UID()
msg = self.sendSampleMessage(body)
Expand All @@ -137,8 +141,11 @@ def test_send_test_issue_with_resolveuid_image(self):
self.assertIn('Content-ID: <image_1>\nContent-Type: image/png;', msg)

def test_send_test_issue_with_resolveuid_scale_image(self):
# for plone < 4.2 we need to ensure turn on to resolveuid links
tinymce = queryUtility(ITinyMCE)
tinymce.link_using_uids = True

body = '<img src="resolveuid/%s/@@images/image/tile"/>' % self.image.UID()
body = '<img src="../../resolveuid/%s/@@images/image/tile"/>' % self.image.UID()
msg = self.sendSampleMessage(body)

self.assertNotIn('resolveuid', msg)
Expand Down

0 comments on commit 9a276e3

Please sign in to comment.