[Zope] Using PUT_factory for objects outside of ZODB
John Barham
jbarham at gmail.com
Tue Mar 7 06:10:17 EST 2006
I want to be able to intercept PUT requests to Zope to store objects
outside of the ZODB by storing the body of the PUT request in an SQL
database. I've written a PUT_factory external method that calls the
function PUT_ParameterFile defined below:
==========
[...boilerplate Zope imports...]
class ParameterFile(Implicit):
security = ClassSecurityInfo()
security.declareObjectPublic()
security.setDefaultAccess("allow")
def __init__(self, context, job_batch_id, body):
self.context = context
self.job_batch_id = job_batch_id
self.body = body
def PUT(self, REQUEST, RESPONSE):
self.context.SQL_UpdateJobBatchParameterFile(
job_batch_id=self.job_batch_id, parameter_file=self.body)
RESPONSE.setStatus(204)
return RESPONSE
def PUT_ParameterFile(self, name, typ, body):
if typ == "text/plain":
return ParameterFile(self, name, body)
=============
The ParameterFile.PUT method is being called, but then Zope returns w/
the error "Can't pickle <extension class __builtin__.ParameterFile at
72918728>: attribute lookup __builtin__.ParameterFile failed". Why is
Zope trying to pickle the ParameterFile object when it's handling PUT
itself?
TIA,
John
More information about the Zope
mailing list