Add finalizeEditHandler to Plugins API
Moved from
Bugs:Item2935
- please reopen the bug if there is agreement to do this.
I have recently refactored TWiki::UI::Edit::edit in a minor way to allow reuse of the edit routine from within plugins that want to edit part of the topic.
If one were to insert a new handler, say
finalizeEditHandler before the edit page is written out, those plugins could do their job without having to call edit directly, making the API clean.
I have this written and tested, and wonder whether it would be prefered to have this code in rather than the simple refactoring. We don't need to publish the handler, but I would feel better if I would not have to call a core routine from the plugin.
Guidance requested...
--
ThomasWeigert
Every time we add a handler that assumes the algorithms employed in the core, we freeze the core code a bit more, making it more brittle and increasing the maintenance problems. I agree it's not good to call functions in the core, but adding handlers has the same effect in the long term.
If you had seen the trouble I have had maintaining ill-considered or poorly designed handlers and API functions in the past (I'm thinking of the code added specifically to support SessionPlugin here), you would share my concern.
Can you do two things:
- State the spec of the proposed handler, detailing where and how it would be used (with an example)
- Explain how two plugins that both support the handler would interact?
--
CrawfordCurrie
Oh boy, you are right on (2). This handler would have to be invoked by only one plugin at a time. Maybe that is not quite the spirit of a plugin? Are there "exclusive plugins"? Should there be?
--
ThomasWeigert
Yes, there are, for some handlers; that is one of the horriblenesses I had to deal with. I'd like to hear what Sven has to ssay on this, as he has done a lot of work on inline editing, and must have solved this problem before.
--
CrawfordCurrie