[Zope] Re: [Zope-dev] post-publishing hook

Florent Guillaume fg@nuxeo.com
Fri, 13 Dec 2002 07:15:16 +0000 (UTC)


Shane Hathaway  <shane@zope.com> wrote:
> On 11/29/2002 01:33 PM, Ivo van der Wijk wrote:
> 
> > On Fri, Nov 29, 2002 at 01:07:24PM +0100, Carlo Giomini wrote:
> >
> > >Dear all,
> > >I need a sort of post-publishing hook (so to say). I need Zope to call a
> > >function of mine as the very last action of publishing a request, 
> > i.e. after
> > >having built the response (and sent it to the browser possibly), but
> > >before starting publishing a new request. My Zope server is running as a
> > >single-threaded app.
> > >Does Zope support this any way?
> 
> > You'll be working outside the REQUEST transaction at that moment, so 
> > please
> > keep that in mind when modifying objects.
> 
> In fact, the database connection might already be closed.  If you need 
> to read or write the ZODB, you might have to open a private connection 
> and close it before returning.  Ugh.

Indeed, the connection has already been closed at that point so you will
need to open a new one. Note also that you won't be able to report any
error to the user (obviously).

Florent
-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com