[Checkins] SVN: zopyx.smartprintng.core/trunk/zopyx/smartprintng/core/ fixes in image handling

Andreas Jung andreas at andreas-jung.com
Fri Oct 3 10:27:19 EDT 2008


Log message for revision 91707:
  fixes in image handling
  

Changed:
  U   zopyx.smartprintng.core/trunk/zopyx/smartprintng/core/adapters.py
  U   zopyx.smartprintng.core/trunk/zopyx/smartprintng/core/renderer.py

-=-
Modified: zopyx.smartprintng.core/trunk/zopyx/smartprintng/core/adapters.py
===================================================================
--- zopyx.smartprintng.core/trunk/zopyx/smartprintng/core/adapters.py	2008-10-03 13:59:38 UTC (rev 91706)
+++ zopyx.smartprintng.core/trunk/zopyx/smartprintng/core/adapters.py	2008-10-03 14:27:19 UTC (rev 91707)
@@ -20,7 +20,6 @@
         self.context = context
 
     def fetch(self, src):
-
         img_tp = urlparse.urlparse(src)
         if not img_tp[0] in ('http', 'https', 'ftp'):
             raise ValueError('Unable to handle image reference %s' % src)

Modified: zopyx.smartprintng.core/trunk/zopyx/smartprintng/core/renderer.py
===================================================================
--- zopyx.smartprintng.core/trunk/zopyx/smartprintng/core/renderer.py	2008-10-03 13:59:38 UTC (rev 91706)
+++ zopyx.smartprintng.core/trunk/zopyx/smartprintng/core/renderer.py	2008-10-03 14:27:19 UTC (rev 91707)
@@ -147,7 +147,7 @@
             src = img['src'].encode('ascii', 'ignore')
             try:
                 image_path = self._fetchImage(src)
-                img['src'] = img_path
+                img['src'] = image_path
             except Exception, e:
                 LOG.error('Error handling image (%s)' % e, exc_info=True)
                 # remove image from soup since we can handle # the error on our
@@ -173,6 +173,6 @@
         # different image types.
         new_img_path = '%s/%s.png' % (self.tempdir, random.random())
         pil_img = PIL.Image.open(cStringIO.StringIO(img_data))
-        pil_img.save(new_img, 'PNG')
+        pil_img.save(new_img_path, 'PNG')
         del pil_img
         LOG.debug('Image %s stored as %s' % (src, new_img_path))



More information about the Checkins mailing list