Newbie (again) using PIDDLE with Zope
Hi, I asked a question about this a few weeks ago, and didn't get very far, so I have a more specific question for anyone using PIDDLE with Zope (or anyone else with any ideas): I am using Zope 2.5.1, Win 2000 (sorry), PIDDLE 1.0.15. As you will soon learn I am quite new to Zope, and Python, and even OOP as a whole, so please bear with me! 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. I am currently trying to just get testpdfgen.py to work from inside Zope, as an external method. (For those unfamiliar with piddle, this should just create a test pdf document, demonstrating that it works). I have changed testpdfgen.py only very slightly - giving a (hopefully) valid filename in the localfs instance for file creation. testpdfgen is in the Extensions folder, and a few methods it requires (pdfgen, pdfutils, pdfdoc, pdfgeom, pdfmetrics) have been copied into my_Zope_Instance/bin/lib. I have an external method in Zope, called testpdfgen, which is linked to the run function in testpdfgen.py. I have a method that calls <dtml-call testpdfgen>, which results in the following 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. I know there will be a simple answer from those of you in the know, I'm just nowhere near in the know yet! TIA Ashley _________________________________________________________________ Use MSN Messenger to send music and pics to your friends http://www.msn.co.uk/messenger
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)
participants (2)
-
Ashley Lloyd -
Paul Winkler