[Zope-dev] post publishing hook

Chris McDonough chrism at plope.com
Fri Apr 1 10:54:25 EST 2005


When do you think it should be called?  I just had to override
zpublisher_validated_hook to do some stuff that would have been a bit
easier if a different hook existed, but that might be a different use
case...


On Fri, 2005-04-01 at 10:48, 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.
> 
> Open issues are:
> 1. what if there's an exception in the hook? I'd say log it but that's all.
> 2. what if there's a Conflicterror? That's tougher to deal with... The 
> transaction has to be retried, without the user being aware of it, so it 
> means the hook should probably be called *before* things are sent to the 
> browser.
> 
> What do you think?
> 
> Florent



More information about the Zope-Dev mailing list