Skip to content
Browse files

add support for @@images in image urls

  • Loading branch information...
1 parent 53cff4d commit c8a7a008f02da323534f518567ac014a395b5228 @MrTango MrTango committed May 22, 2012
Showing with 8 additions and 21 deletions.
  1. +6 −7 Products/EasyNewsletter/content/ENLIssue.py
  2. +1 −13 Products/EasyNewsletter/tests/test_newsletter.py
  3. +1 −1 setup.py
View
13 Products/EasyNewsletter/content/ENLIssue.py
@@ -378,12 +378,6 @@ def send(self, recipients=[]):
outer.epilogue = ''
# Attach text part
- #text_part = MIMEText(personal_text_plain, "plain", charset)
-
- # Attach html part with images
- #html_part = MIMEText(personal_text, "html", charset)
-
- # Attach text part
text_part = MIMEMultipart("related")
text_part.attach(MIMEText(personal_text_plain, "plain", charset))
@@ -396,7 +390,6 @@ def send(self, recipients=[]):
image_number = 0
reference_tool = getToolByName(self, 'reference_catalog')
for image_url in image_urls:
- #XXX: we need to provide zope3 resource image too!
try:
image_url = urlparse(image_url)[2]
if 'resolveuid' in image_url:
@@ -406,6 +399,12 @@ def send(self, recipients=[]):
if o and urlparts:
# get thumb
o = o.restrictedTraverse(urlparts[0])
+ elif "@@images" in image_url:
+ image_url_base, image_scale_params = image_url.split("@@images")
+ image_scale = image_scale_params.split("/")[-1]
+ scales = self.restrictedTraverse(
+ urllib.unquote(image_url_base + '@@images'))
+ o = scales.scale('image', scale=image_scale)
else:
o = self.restrictedTraverse(urllib.unquote(image_url))
except Exception, e:
View
14 Products/EasyNewsletter/tests/test_newsletter.py
@@ -80,19 +80,7 @@ def test_send_test_issue(self):
self.assertTrue('From: ACME newsletter <newsletter@acme.com>' in msg)
+
def test_suite():
return unittest.defaultTestLoader.loadTestsFromName(__name__)
-#raceback (innermost last):
-# Module ZPublisher.Publish, line 127, in publish
-# Module ZPublisher.mapply, line 77, in mapply
-# Module Products.PDBDebugMode.runcall, line 70, in pdb_runcall
-# Module ZPublisher.Publish, line 47, in call_object
-# Module Products.EasyNewsletter.browser.issue, line 23, in send_issue
-# Module Products.EasyNewsletter.content.ENLIssue, line 366, in send
-# Module email.header, line 176, in __init__
-# Module email.header, line 260, in append
-#UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 75: ordinal not in range(128)
-#*** SyntaxError: invalid syntax (<stdin>, line 1)
-#> /usr/lib/python2.6/email/header.py(260)append()
-#-> ustr = unicode(s, incodec, errors)
View
2 setup.py
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages
-version = '2.6.6.dev0'
+version = '2.6.5'
setup(name='Products.EasyNewsletter',
version=version,

0 comments on commit c8a7a00

Please sign in to comment.
Something went wrong with that request. Please try again.