changeset 2036:8f709cef5aa5

Page.getACL: don't cache acls for nonexisting pages. PageEditor.copyPage tests now the newpagename
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 05 May 2007 11:44:37 +0200
parents a7fb50fd67f6
children a63c473a100d
files MoinMoin/Page.py MoinMoin/PageEditor.py
diffstat 2 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Tue May 01 21:27:15 2007 +0200
+++ b/MoinMoin/Page.py	Sat May 05 11:44:37 2007 +0200
@@ -1511,8 +1511,14 @@
             #logging.debug("currrev: %r, cachedaclrev: %r" % (currentRevision, aclRevision))
             if aclRevision != currentRevision:
                 acl = self.parseACL()
-                cache_data = (currentRevision, acl)
-                request.cfg.cache.meta.putItem(request, cache_name, cache_key, cache_data)
+                if currentRevision != 99999999:
+                    # don't use cache for non existing pages
+                    # otherwise in the process of creating copies by filesys.copytree (PageEditor.copyPage)
+                    # the first may test will create a cache entry with the default_acls for a non existing page 
+                    # At the time the page is created acls on that page would be ignored until the process
+                    # is completed by adding a log entry into edit-log
+                    cache_data = (currentRevision, acl)
+                    request.cfg.cache.meta.putItem(request, cache_name, cache_key, cache_data)
             self.__acl = acl
             request.clock.stop('getACL')
             return acl
--- a/MoinMoin/PageEditor.py	Tue May 01 21:27:15 2007 +0200
+++ b/MoinMoin/PageEditor.py	Sat May 05 11:44:37 2007 +0200
@@ -527,10 +527,8 @@
             self.error = None
             if not comment:
                 comment = u"## page was copied from %s" % self.page_name
-            if request.user.may.write(self.page_name):
-                # ToDo: check difference to request.user.may.write(newpagename)
-                # If current user has write access to the old page
-                # Save page text with a comment about the old 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, index=0, extra=self.page_name, action='SAVE')
             else: