Generated Images Again
As you might recall, I am on a quest to get Zope to serve up automatically generated images. I am nearly there. In a simple example, my DTML looks like the following: <!--#var standard_html_header--> <h2><!--#var title_or_id--></h2> <p> <IMG SRC="GenerateImage"> </p> <!--#var standard_html_footer--> My external method kind of looks like this: def GenerateImage(self, RESPONSE): bits = functionThatWritesImageIntoAString() RESPONSE.setHeader('content-type', 'image/png') return bits This works fine. However, functionThatWritesImageIntoAString() actually takes arguments. So, I attempted the following: def GenerateImage(self, RESPONSE, arg): Then I tried several possibilities in DTML: <IMG SRC="GenerateImage(arg)"> <IMG SRC="GenerateImage(RESPONSE,arg)"> I tried permuting arguments. I can't convince it to work. It appears that I don't know the magic to tell Zope to pass arguments to the external method. I am looking for suggestions. There is a really nasty workaround: I could use <dtml-call> before the <IMG> tag to pass arguments implcitly (through globals) to the GenerateImage method. But this seems really ugly. I am looking for a more graceful solution. David S. Harrison (dsh@magma-da.com)
participants (1)
-
David S. Harrison