[Zope] Displaying PIL Images in Zope Templates

Nico Grubert nicogrubert at gmail.com
Thu Sep 18 02:22:37 EDT 2008


 > > The <span> renders "<PIL.Image.Image instance at 0x23b97500>".
 > > How can I show the image?

 > Call its tag method.

 >    <span tal:replace="structure item/tag" />


Hi Paul,

how is the susi going? ;-)

I tried <span tal:replace="structure item/tag" /> but I get the 
following error:
-----------------------------------------------------------------------
Exception Type  	TraversalError
Exception Value 	(<PIL.Image.Image instance at 0x18e84ad0>, 'tag')

     *  Module Products.PageTemplates.Expressions, line 153, in _eval
     * Module zope.tales.expressions, line 124, in _eval
     * Module Products.PageTemplates.Expressions, line 83, in 
boboAwareZopeTraverse
     * Module zope.traversing.adapters, line 164, in traversePathElement
       __traceback_info__: (<PIL.Image.Image instance at 0x18e84ad0>, 'tag')
     * Module zope.traversing.adapters, line 52, in traverse
       __traceback_info__: (<PIL.Image.Image instance at 0x18e84ad0>, 
'tag', [])

TraversalError: (<PIL.Image.Image instance at 0x18e84ad0>, 'tag')
-----------------------------------------------------------------------


However, I could not find any "tag" attribute in the lists of available 
attributes of the PIL.Image.Image instance. dir(<PIL_object>) returns:
['_Image__transformer', '__doc__', '__getattr__', '__init__', 
'__module__', '_copy', '_dump', '_expand', '_makeself', '_new', 
'category', 'convert', 'copy', 'crop', 'draft', 'encoderconfig', 
'encoderinfo', 'filter', 'format', 'format_description', 'fromstring', 
'getbands', 'getbbox', 'getcolors', 'getdata', 'getextrema', 'getim', 
'getpalette', 'getpixel', 'getprojection', 'histogram', 'im', 'info', 
'load', 'mode', 'offset', 'palette', 'paste', 'point', 'putalpha', 
'putdata', 'putpalette', 'putpixel', 'quantize', 'readonly', 'resize',
'rotate', 'save', 'seek', 'show', 'size', 'split', 'tell', 'thumbnail', 
'tobitmap', 'tostring', 'transform', 'transpose', 'verify']

No "tag" method there... :-(


Regards
Nico


More information about the Zope mailing list