[reportlab-users] Problems publishing in Zope

Florian Reiser reportlab-users@reportlab.com
Thu, 7 Oct 2004 09:50:58 +0200 (MEST)


Hello Sherman,

this error of Zope indicates that Zope wants to store your object with the
doc attribute in ZODB.
Try the following
       report= StringIO.StringIO()
       ...
       # create the document handle
       doc = SimpleDocTemplate(report, pagesize = self.pagesize,
 topMargin=(1.5* inch), bottomMargin=(inch* 2))
       RESPONSE.setHeader('Content-Type', 'application/pdf')
       RESPONSE.setHeader('Content-Disposition',
'inline;filename=%s.pdf'%self.id
       return doc

Then everything should run fine.

Greets
Florian

> Hello,
> 
> I have a script that generates a pdf file.  It uses platypus using a
> SimpleDocTemplate.  It works great.  So, now I want to incorporate it
> into Zope.  Using Jerome Alet's Zope demonstration script as a guide
> (which uses a BaseDocTemplate) I duplicated functionality.  
> 
> Instead of giving my SimpleDocTemplate a filename I pass a StringIO
> object.   
> 
> WAS:  
>       reportfile= "Sample.pdf"
>       ...
>       # create the document handle
>       doc = SimpleDocTemplate(reportfile, pagesize = self.pagesize,
> topMargin=(1.5* inch), bottomMargin=(inch* 2))
>   
> IS NOW:
>       report= StringIO.StringIO()
>       ...
>       # create the document handle
>       self.doc = SimpleDocTemplate(report, pagesize = self.pagesize,
> topMargin=(1.5* inch), bottomMargin=(inch* 2))
> 
> 
> Now, however I am getting an error "can't pickle StringO objects".  I
> did not explicitly declare anything a StringO object, so it must be
> inherited somewhere along the line.  
> 
> Can anyone explain how to get around this?  Like I said it writes to a
> file (as a stand alone script) just fine.  I installed and ran Jerome's
> example (that uses StringIO) and it works fine. Do you know of any other
> examples of using reportlab internal to Zope that might help?
> 
> TIA
> Sherman
> 
> _______________________________________________
> reportlab-users mailing list
> reportlab-users@reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users
> 

-- 
GMX ProMail mit bestem Virenschutz http://www.gmx.net/de/go/mail
+++ Empfehlung der Redaktion +++ Internet Professionell 10/04 +++