-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 John Barham wrote: > 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?
The "PUT factory" has a contract that it return an object, which will then be "seated" in its container, after which its PUT method will be called. If you don't want that behavior, then you need to use a custom container which overrides PUT itself, rather than trying to use the one in the 'webdav' package. Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 [EMAIL PROTECTED] Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFEDX9U+gerLs4ltQ4RAkm0AKCQcOw4cwIoOtvRlkOCSa6AnfQRWQCfXgEa L9OVqmOmjf1x1jQ8pvGcVIw= =I+rr -----END PGP SIGNATURE----- _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )