[Zope] Create Image w PIL and save to OFS.Image.Image subclass instance

hans hans@beehive.de
Mon, 18 Mar 2002 18:44:57 +0000


want to create a grafik w PIL and store into my instance which is
subclassed from OFS.Image.Image.

Excerpt: def manage_draw_PraxisIndex
             ...
             sql_graph = [ (1, 8), (16, 8), (1, 9), (16, 9) ]

             import PIL.Image    # name clash PIL.Image % OFS.Image
             import PIL.ImageDraw

             #                        mode, size
             thePic = PIL.Image.new( "RGB", (17, 17) )

             draw = PIL.ImageDraw.Draw(thePic)
             draw.line( sql_graph)

             from cStringIO import StringIO
             pic_File = StringIO('')

201>>  thePic.save(pic_File)



Error Type: KeyError
Error Value:

Traceback (innermost last):
  File C:\PROGRA~1\Zope232\lib\python\ZPublisher\Publish.py, line 223,
in publish_module
  File C:\PROGRA~1\Zope232\lib\python\ZPublisher\Publish.py, line 187,
in publish
  File C:\PROGRA~1\Zope232\lib\python\Zope\__init__.py, line 221, in
zpublisher_exception_hook
    (Object: rki)
  File C:\PROGRA~1\Zope232\lib\python\ZPublisher\Publish.py, line 171,
in publish
  File C:\PROGRA~1\Zope232\lib\python\ZPublisher\mapply.py, line 160, in
mapply
    (Object: manage_draw_PraxisIndex)
  File C:\PROGRA~1\Zope232\lib\python\ZPublisher\Publish.py, line 112,
in call_object
    (Object: manage_draw_PraxisIndex)
  File C:\Programme\Zope232\lib\python\Products\PraxInd\RKI.py, line
201, in manage_draw_PraxisIndex
    (Object: rki)
  File C:\Programme\Zope232\bin\PIL\Image.py, line 681, in save
KeyError: (see above)

what did i miss?

Also: How does an image get displayed, when
<img src="myImageURL">,
what is the browser request and to which call (of Image) will it get
mapped?

thanks a lot, cheers hans
--
-------------------------------------------------------------
Who's got only a hammer sees the world as a nail
hans augustin  (software developer)           hans@beehive.de
beehive elektronische medien GmbH       http://www.beehive.de
phone: +49 30 847-82 0                  fax: +49 30 847-82 299