changeset 539:8abd2a7e6e85

ignore ConvertErrors when user cancelled editing imported from: moin--main--1.5--patch-543
author Thomas Waldmann <tw@waldmann-edv.de>
date Sun, 09 Apr 2006 11:21:32 +0000
parents b75b2c863349
children f9af485c696c
files ChangeLog MoinMoin/wikiaction.py docs/CHANGES
diffstat 3 files changed, 38 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Apr 09 11:00:00 2006 +0000
+++ b/ChangeLog	Sun Apr 09 11:21:32 2006 +0000
@@ -2,6 +2,20 @@
 # arch-tag: automatic-ChangeLog--arch@arch.thinkmo.de--2003-archives/moin--main--1.5
 #
 
+2006-04-09 12:21:32 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-543
+
+    Summary:
+      ignore ConvertErrors when user cancelled editing
+    Revision:
+      moin--main--1.5--patch-543
+
+    ignore ConvertErrors when user cancelled editing
+    
+
+    modified files:
+     ChangeLog MoinMoin/wikiaction.py docs/CHANGES
+
+
 2006-04-09 12:00:00 GMT	Alexander Schremmer <alex@alexanderweb.de.tla>	patch-542
 
     Summary:
--- a/MoinMoin/wikiaction.py	Sun Apr 09 11:00:00 2006 +0000
+++ b/MoinMoin/wikiaction.py	Sun Apr 09 11:21:32 2006 +0000
@@ -567,23 +567,30 @@
     if savetext is None:
         pg.sendEditor()
         return
+  
+    # did user hit cancel button?
+    cancelled = request.form.has_key('button_cancel')
 
     # convert input from Graphical editor
-    if lasteditor == 'gui':
-        from MoinMoin.converter.text_html_text_x_moin import convert
-        savetext = convert(request, pagename, savetext) # XXX error handling
+    from MoinMoin.converter.text_html_text_x_moin import convert, ConvertError
+    try:
+        if lasteditor == 'gui':
+            savetext = convert(request, pagename, savetext) # XXX error handling
+                
+        # IMPORTANT: normalize text from the form. This should be done in
+        # one place before we manipulate the text.
+        savetext = pg.normalizeText(savetext, stripspaces=rstrip)
+    except ConvertError:
+        # we don't want to throw an exception if user cancelled anyway
+        if not cancelled:
+            raise
 
-    # IMPORTANT: normalize text from the form. This should be done in
-    # one place before we manipulate the text.
-    savetext = pg.normalizeText(savetext, stripspaces=rstrip)
+    if cancelled:
+        pg.sendCancel(savetext or "", rev)
+        return
 
     comment = wikiutil.clean_comment(comment)
 
-    # Edit was canceled
-    if request.form.has_key('button_cancel'):
-        pg.sendCancel(savetext or "", rev)
-        return
-
     # Add category
 
     # TODO: this code does not work with extended links, and is doing
--- a/docs/CHANGES	Sun Apr 09 11:00:00 2006 +0000
+++ b/docs/CHANGES	Sun Apr 09 11:21:32 2006 +0000
@@ -28,6 +28,12 @@
     and improving it and after having made a backup with some other, proven
     method. USE BOTH ON YOUR OWN RISK!
 
+Version 1.5.3-current:
+  New Features:
+  Other Changes:
+    * We catch and ignore html to wiki conversion errors in case of hitting
+      the cancel button, so you can get out of the error screen.
+
 Version 1.5.3-rc2:
   New Features:
     * Modified SystemInfo macro to give human readable units and disk usage