Florent Guillaume wrote:
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.
I'd rather not take the time to discuss this now, since we seem to be on track with the transaction idea, which I still think is a better fit. If you really want to discuss this now, I'll respond, although maybe not today. :) Jim -- Jim Fulton mailto:jim@zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org