The request object has a hold area which keeps objects alive as long as 
the request lives. Although I have not tried it, you might be able to 
add an object to this hold area using __bobo_traverse__ defined on B.

This object's class would need to have a destructor method (__del__) 
defined so that it can do something when the request is over and the 
response has presumably been written.

you could code that something like this:

In b's class:

class b:
     ...
     def __bobo_traverse__(self, name):
         self.REQUEST._hold(ResponseChecker(self.REQUEST.RESPONSE))

class ResponseChecker:
     def __init__(self, response):
         self.response = response

     def __del__(self):
         ...do something with self.response...

Like I said, I've never tried this, but you never know, it might work. 
If not, another option would be to have b use __bobo_traverse__ to 
dynamically add a destructor to the RESPONSE object (it doesn't already 
have one AFAIK). Like this:

class b:
     ...
     def __bobo_traverse__(self, name):
         self.REQUEST.RESPONSE.__del__ = afterResponse

def afterResponse(self):
     ...do something with response...

The latter is a monkey patch, but a very narrow one, since the hook 
would only get put in for objects under an instance of b.

-Casey

Ivo van der Wijk wrote:
> Hi All,
> 
> I would like to do some bookkeeping *after* an object has been published,
> i.e. imagine a request is done for:
> 
> /a/b/c/d
> 
> 'b' is the (folderish) object that does the accounting, 'd' is the object
> to be published. I would like 'b' to examine the RESPONSE after publishing.
> 
> I know there's a __before_publishing_traverse__, however, this is not what
> I want.
> 
> Does someone know a way to implement this cleanly? I.e. without monkeypatching
> 'd' (which can be any kind of zope object)?
> 
> Regards,
> 
>       Ivo
> 
> 




_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to