Hello: 
    I came across webware when researching reportlab and the
functionality of serving a pdf file on the fly.
I am referencing the following URL:
  http://wiki.w4py.org/pdfcreationwithreportlab.html
Below is the entire code for test.py
#!/usr/local/bin/python
import sys
sys.path.append('/usr/local/lib/python2.3/site-packages/Webware')
sys.path.append('/usr/lib/python2.3/site-packages')
from WebKit.Page import Page
from reportlab.pdfgen import canvas
from reportlab.lib.units import cm

class hello(Page):
 def writeHTML(self):
  c = canvas.Canvas(None)
  c.drawString(9*cm, 27*cm, 'Hello, World!')
  r = c.getpdfdata()
  self.response().setHeader('Content-Type', 'application/pdf')
  self.response().setHeader('Content-Length', str(len(r)))
  self.response().setHeader('Content-Disposition', 'inline; filename="hello.pdf"')
  self.write(r)
H = hello()
H.writeHTML()
## and below is the error report, other comments follow error report
Traceback (most recent call last):
  File "test.py", line 19, in ?
    H.writeHTML()
  File "test.py", line 14, in writeHTML
    self.response().setHeader('Content-Type', 'application/pdf')
  File "WebKit/Page.py", line 95, in response
AttributeError: hello instance has no attribute '_response'
## I looked at the Page class, and it has no __init__ method,
##   therefore, the _response attribute is not created.

What else do I need to do to initialize and instance of Page
and use it properly?

Pointers to documentation is welcome and invited.
thanks
tim
-- 
Tim Johnson <[EMAIL PROTECTED]>
      http://www.alaska-internet-solutions.com


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to