changeset 1642:0101edf9d308

Delete page in the rollback case if it was deleted before.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Sat, 28 Oct 2006 21:56:51 +0200
parents b2322cdabd8a
children eddb24012ed2
files MoinMoin/action/SyncPages.py
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/SyncPages.py	Tue Oct 03 15:32:55 2006 +0200
+++ b/MoinMoin/action/SyncPages.py	Sat Oct 28 21:56:51 2006 +0200
@@ -440,14 +440,18 @@
                 new_local_rev = current_page.get_real_rev() # YYY direct access
 
                 def rollback_local_change(): # YYY direct local access
+                    comment = u"Wikisync rollback"
                     rev = new_local_rev - 1
                     revstr = '%08d' % rev
                     oldpg = Page(self.request, sp.local_name, rev=rev)
                     pg = PageEditor(self.request, sp.local_name)
-                    try:
-                        savemsg = pg.saveText(oldpg.get_raw_body(), 0, comment=u"Wikisync rollback", extra=revstr, action="SAVE/REVERT")
-                    except PageEditor.Unchanged:
-                        pass
+                    if not oldpg.exists():
+                        pg.deletePage(comment)
+                    else:
+                        try:
+                            savemsg = pg.saveText(oldpg.get_raw_body(), 0, comment=comment, extra=revstr, action="SAVE/REVERT")
+                        except PageEditor.Unchanged:
+                            pass
                     return sp.local_name
 
                 if local_change_done: