Tags:
archive_me1Add my vote for this tag create new tag
, view all tags

Fix for afterEditHandler Bug in TWiki 4.0.0 - 4.0.4

The afterEditHandler is only called by preview, not save. This makes makes a beforeEditHandler / afterEditHandler pair asymmetric, e.g. Plugins can't change content before edit and revert it back in a consistent way. This is fixed in Bugs:Item2602, SVN 10882.

Patch

Change file lib/TWiki/UI/Save.pm of TWiki 4.0.0 - 4.0.4 with this patch:

--- Save.pm.save1       Fri Mar 31 14:18:01 2006
+++ Save.pm     Sat Jul  8 00:52:10 2006
@@ -455,6 +455,10 @@
     my( $newMeta, $newText, $saveOpts, $merged ) =
       TWiki::UI::Save::buildNewTopic($session, 'save');

+    if( $saveaction =~ /^(save|checkpoint)$/ ) {
+        $session->{plugins}->afterEditHandler( $newText, $topic, $web );
+    }
+
     try {
         $store->saveTopic( $user, $web, $topic,
                            $newText, $newMeta, $saveOpts );

Learn HowToApplyPatch.

HELP Note: Instead of applying the patch you can easily install the files of HotFix04x00x01x01, which fixes also this bug.

-- Contributors: PeterThoeny - 08 Jul 2006

Discussion

what happens when save is called without the edit step at all?

  • The handler is called if there is an action_save parameter. -- PeterThoeny - 08 Jul 2006

-- SvenDowideit - 08 Jul 2006

Presumably this applies to TWiki 4.0.0, 4.0.1, 4.0.2, 4.0.3 and 4.0.4 but is fixed thereafter. Saying it applies to "TWiki 4.0.x" assumes there will not be a 4.0.5.

-- MartinCleaver - 08 Jul 2006

We plan for 4.1, hopefully we won't need to build a 4.0.5 relase! Fixed TWiki version with range on top.

-- PeterThoeny - 08 Jul 2006

We planned for 4.1 instead of 4.0.4 also.

-- MeredithLesly - 08 Jul 2006

are Store.pm (in Hotfix Anouncement http://twiki.org/cgi-bin/view/Codev/HotFix04x00x01x01 ) and Save.pm the same? the hotfix file contains Save.pm

-- FerdinandGassauer - 10 Jul 2006

No, Store.pm and Save.pm are two different modules. Save.pm implements the save command and is in the UI section. Store relates to how the data is stored, adding a level of abstraction to (in theory) allow alternative stores.

-- MeredithLesly - 10 Jul 2006

Paths are lib/TWiki/UI/Save.pm and lib/TWiki/Store.pm

-- MartinCleaver - 10 Jul 2006

Thanks Martin!

-- MeredithLesly - 10 Jul 2006

It was a typo on the Hotfic topic. The file in the hotfix is UI/Save.pm and this is the correct one. I have corrected the hotfix topic. Sorry for the confusion.

And to clarify. Yes. The hotfix also contains the fix for the problem described above. Same fix.

-- KennethLavrsen - 10 Jul 2006

 
Topic revision: r11 - 10 Jul 2006 - 16:12:45 - KennethLavrsen
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback