[Zope] Newbie (again) using PIDDLE with Zope

Paul Winkler pw_lists@slinkp.com
Tue, 1 Apr 2003 07:43:50 -0800


On Tue, Apr 01, 2003 at 09:55:33AM +0100, Ashley Lloyd wrote:
> I am hoping to use piddle to generate PDF documents on-the-fly, and the 
> current train of thought is: in response to a user request, create a PDF 
> document in a localfs instance, then open that document.

that could work. BUT... i don't know if piddle is thread-safe or not.
That would be a question for the piddle mailing list (is it still active?).
If not, you'll need to be a bit more careful, because you don't want
one user's request to get garbled with another user's request and get
a PDF that's a hybrid of the two.

You might also look into reportlab (www.reportlab.com) which is
similar in many ways to piddle but has fewer output formats
(only PDF and, with an optional extension, bitmaps)
and it's more actively developed..
reportlab is NOT thread-safe, so you need to run it in a separate process 
from your external method,

also, there are examples of using reportlab with zope... google for 'em...

anyway, on to your error...

> Error Type: AttributeError
> 
> Error Value: 'pdfgen' module has no attribute 'Canvas'
> 
> Error Traceback (most recent call last):
> File "C:\PROGRA~1\ZopeSite\lib\python\DocumentTemplate\DT_Try.py", line 
> 149, in render_try_except result = render_blocks(self.section, md) File 
> "C:\PROGRA~1\ZopeSite\lib\python\Products\ExternalMethod\ExternalMethod.py", 
> line 198, in __call__ try: return apply(f,args,kw) File 
> "C:\PROGRA~1\ZopeSite\Extensions\testpdfgen.py", line 127, in run c = 
> pdfgen.Canvas('/TFEye/localfiles/testpdfgen.pdf') AttributeError: 'pdfgen' 
> module has no attribute 'Canvas'
> _______________________________________________________________________
> 
> Canvas is a class defined in pdfgen.

... well, apparently it's not.
Either that's the wrong name, or it lives somewhere other than pdfgen.
Sorry, I haven't looked at piddle in a long time and don't have it handy...

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's DESTRUCTO-FOOLICIOUS MARKSMAN!
(random hero from isometric.spaceninja.com)