[reportlab-users] Problems publishing in Zope

Sherman Lambert reportlab-users@reportlab.com
Wed, 06 Oct 2004 09:14:56 -0600


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

      reportfile= "Sample.pdf"
      # create the document handle
      doc = SimpleDocTemplate(reportfile, pagesize = self.pagesize,
topMargin=(1.5* inch), bottomMargin=(inch* 2))
      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?