[Zope] External methods and images

Howard Clinton Shaw III shawh@sths.org
Mon, 10 May 1999 12:22:21 -0500


On Mon, 10 May 1999, Tony McDonald wrote:
> >i think what you're seeing is the by-now-infamous ExternalMethod
> >exception-handling bug (tm). ExternalMethod is seeing an exception in some
> >part of the external method. in processing that exception, it assumes the
> >exception type is a string, which it almost never is. this usually causes a
> >second exception in the exception-handling code, which kills the function
> >(and produces the traceback you see).
> >
> >i was able to patch it by replacing line 255 in ExternalMethod.py with:
> >
> >-----
> >                if (type(error_type) is type('')) and (lower(error_type) in
> >('redirect',)):
> >-----
> >
> >i know less than nothing about the version control system, or even the bug
> >reporting system (please forgive me, i'm only marginally competent with the
> >systems we use here in-house) so i haven't made the change above "official"
> >in any way. if someone could take care of that, i'd appreciate it.
> 
> Ah, that might explain it. Only problem is that I'm using 
> Zope-1.11.0pr1 and there aren't enough lines in ExternalMethod.py
> 
> All I really want to do is pass the name of an image to an external 
> method which then extracts it from a directory, wraps it up in the 
> content-type magic and sends it back to me. Does anyone have 
> something like it working? Any pointers gratefully received.

Well, haven't got it working... haven't even tested it, but my guess would be
attach the content-type header as plain-text to the front of your return value.
The syntax of the content-type header should be in any CGI manual. I think that
when you access an external method directly it acts very like CGI, in that the
ZPublisher returns it without any preparatory wrapping. So I think you need to
put the header in manually. Good luck.

 > 
> TIA
> Tone
> ------
> Dr Tony McDonald,  FMCC, Networked Learning Environments Project
> The Medical School, Newcastle University Tel: +44 191 222 5888
> Fingerprint: 3450 876D FA41 B926 D3DD  F8C3 F2D0 C3B9 8B38 18A2
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
> 
> (For developer-specific issues, use the companion list,
> zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
--
Howard Clinton Shaw III - Grum
St. Thomas High School
#include <disclaimer.h>