diff MoinMoin/PageEditor.py @ 3042:353739af70fa

PageEditor: fixed copyPage for write restricted pages, tests added (ported from 1.6)
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Tue, 19 Feb 2008 22:06:50 +0100
parents b545446562a0
children a1322262398a
line wrap: on
line diff
--- a/MoinMoin/PageEditor.py	Thu Feb 14 17:15:04 2008 +0100
+++ b/MoinMoin/PageEditor.py	Tue Feb 19 22:06:50 2008 +0100
@@ -564,16 +564,9 @@
             self.error = None
             if not comment:
                 comment = u"## page was copied from %s" % self.page_name
-            if request.user.may.write(newpagename):
-                # Save page text with a comment about the old name and log entry
-                savetext = u"## page was copied from %s\n%s" % (self.page_name, savetext)
-                newpage.saveText(savetext, 0, comment=comment, extra=self.page_name, action='SAVE', notify=False)
-            else:
-                # if user is  not able to write to the page itselfs we set a log entry only
-                from MoinMoin import packages
-                rev = newpage.current_rev()
-                packages.edit_logfile_append(self, newpagename, newpath, rev, 'SAVENEW', logname='edit-log',
-                                       comment=comment, author=u"CopyPage action")
+            savetext = u"## page was copied from %s\n%s" % (self.page_name, savetext)
+            Page.__init__(self, request, newpagename)
+            self._write_file(savetext, "SAVENEW", comment)
 
             event = PageCopiedEvent(request, newpage, self, comment)
             send_event(event)
@@ -824,7 +817,6 @@
             # Strip trailing spaces if needed
             if kw.get('stripspaces', 0):
                 lines = [line.rstrip() for line in lines]
-
             # Add final newline if not present, better for diffs (does
             # not include former last line when just adding text to
             # bottom; idea by CliffordAdams)