[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kupu-checkins
Subject:    [kupu-checkins] r54982 - in kupu/trunk/kupu/plone: . tests
From:       duncan () codespeak ! net
Date:       2008-05-20 8:24:43
Message-ID: 20080520082443.25A4B2A8002 () codespeak ! net
[Download RAW message or body]

Author: duncan
Date: Tue May 20 10:24:41 2008
New Revision: 54982

Modified:
   kupu/trunk/kupu/plone/html2captioned.py
   kupu/trunk/kupu/plone/kupu2html.py
   kupu/trunk/kupu/plone/tests/test_html2captioned.py
Log:
Fix PortalTransforms imports broken by Laurence's checkin


Modified: kupu/trunk/kupu/plone/html2captioned.py
==============================================================================
--- kupu/trunk/kupu/plone/html2captioned.py	(original)
+++ kupu/trunk/kupu/plone/html2captioned.py	Tue May 20 10:24:41 2008
@@ -7,8 +7,12 @@
 # The transform finds all the embedded images, and replaces them with
 # an appropriate chunk of HTML to include the caption.
 #
-from Products.PortalTransforms.interfaces import itransform
-from Products.PortalTransforms.z3.interfaces import ITransform
+try:
+    from Products.PortalTransforms.z3.interfaces import ITransform
+except ImportError:
+    ITransform = None
+    from Products.PortalTransforms.interfaces import itransform
+
 from DocumentTemplate.DT_Util import html_quote
 from DocumentTemplate.DT_Var import newline_to_br
 from Products.CMFCore.utils import getToolByName
@@ -72,7 +76,8 @@
 
 class HTMLToCaptioned:
     """Transform which adds captions to images embedded in HTML"""
-    implements(ITransform)
+    if ITransform is not None:
+        implements(ITransform)
     __implements__ = itransform
     __name__ = "html_to_captioned"
     inputs = ('text/html',)

Modified: kupu/trunk/kupu/plone/kupu2html.py
==============================================================================
--- kupu/trunk/kupu/plone/kupu2html.py	(original)
+++ kupu/trunk/kupu/plone/kupu2html.py	Tue May 20 10:24:41 2008
@@ -7,15 +7,20 @@
 # The transform is the same as the one done by html2captioned, but
 # this version expects to work on text/x-html-raw
 
-from Products.PortalTransforms.interfaces import itransform
-from Products.PortalTransforms.z3.interfaces import ITransform
+try:
+    from Products.PortalTransforms.z3.interfaces import ITransform
+except ImportError:
+    ITransform = None
+    from Products.PortalTransforms.interfaces import itransform
+
 from Products.kupu.plone import html2captioned
 from Products.CMFCore.utils import getToolByName
 from zope.interface import implements
 
 class KupuOutputTransform(html2captioned.HTMLToCaptioned):
     """Transform which adds captions to images embedded in HTML"""
-    implements(ITransform)
+    if ITransform is not None:
+        implements(ITransform)
     __implements__ = itransform
     __name__ = "kupu_raw_to_html"
     inputs = ('text/x-html-raw',)

Modified: kupu/trunk/kupu/plone/tests/test_html2captioned.py
==============================================================================
--- kupu/trunk/kupu/plone/tests/test_html2captioned.py	(original)
+++ kupu/trunk/kupu/plone/tests/test_html2captioned.py	Tue May 20 10:24:41 2008
@@ -8,7 +8,10 @@
 from os.path import join, abspath, dirname
 
 from Products.PortalTransforms.tests.test_transforms import *
-from Products.PortalTransforms.z3.interfaces import IDataStream
+try:
+    from Products.PortalTransforms.z3.interfaces import IDataStream
+except ImportError:
+    IDataStream = None
 from Products.PortalTransforms.tests.utils import normalize_html
 from Products.kupu import kupu_globals
 
@@ -40,7 +43,8 @@
         input.close()
         data = datastream(self.transform.name())
         res_data = self.transform.convert(orig, data, filename=filename, context=self.portal)
-        self.assert_(IDataStream.providedBy(res_data))
+        if IDataStream is not None:
+            self.assert_(IDataStream.providedBy(res_data))
         got = res_data.getData()
         try:
             output = open(output)
_______________________________________________
kupu-checkins mailing list
kupu-checkins@codespeak.net
http://codespeak.net/mailman/listinfo/kupu-checkins
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic