[Zope-dev] post publishing hook

Florent Guillaume fg at nuxeo.com
Mon Apr 4 11:46:41 EDT 2005


Jim Fulton wrote:
> Florent Guillaume wrote:
> 
>> I really could use a post publishing hook.
>> Standard use case: delay indexing at the end of the request to only do 
>> it once per object even if the object has been modified 4 times.
>>
>> Today there's the REQUEST._hold() hack with an instance having a 
>> __del__, but this gets executed outside the main transaction, and 
>> REQUEST is already dying.
>>
>> I'd like a post-publishing hook that's called in the initial REQUEST 
>> and transaction.
> 
> I haven't been folowing this thread, so I asked Gary what it was about. :)
> Based on that, I'd like to suggest:
> 
> There are two possibilities:
> 
> 1. A post publishing hook.  I think this would be appropriate
>    in the case where you really want to augment the publishing
>    process.  For example, I hpe someday to use something like
>    this to provide another way (other than metal) to provide
>    standard look and feel.
> 
>    Unfortunately, I think there are a lot of open issues, at least
>    in my mind, about how something like this should work.

What I had in mind was, just after Publish.publish calls

         result = mapply(object, request.args, request, ...)

add:

         if hasattr(request, 'runPostPublishingHooks'):
             result = request.runPostPublishingHooks(result, request, 
response)

And a simple system for registering hooks.

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com


More information about the Zope-Dev mailing list