[Zope] Generating and Downloading PDF

Fernando Lujan flujan at mandic.com.br
Tue Mar 1 16:59:06 EST 2005


I'm using the following code inside a python script, and I receive the message:

Error Type: Unauthorized
Error Value: You are not allowed to access open in this context


Code:

import os
file = "/usr/local/dc/zope-2.6.0/test.pdf"
f = os.open(file)
data = f.read()
f.close()
R = self.REQUEST.RESPONSE
R.setHeader('content-type', 'application/pdf')
R.write(data)



More information about the Zope mailing list