changeset 3595:1dcf6a261c2a

AttachFile: make error msg less confusing when trying to overwrite a file attachment without having acl delete rights
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 12 May 2008 23:39:36 +0200
parents ff60ed56002a
children 82f0586c3bd0
files MoinMoin/action/AttachFile.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Mon May 12 22:49:20 2008 +0200
+++ b/MoinMoin/action/AttachFile.py	Mon May 12 23:39:36 2008 +0200
@@ -570,10 +570,12 @@
     except:
         overwrite = 0
 
-    if (overwrite or not request.user.may.write(pagename)) and \
-       (not overwrite or not request.user.may.write(pagename) or not request.user.may.delete(pagename)):
+    if not request.user.may.write(pagename):
         return _('You are not allowed to attach a file to this page.')
 
+    if overwrite and not request.user.may.delete(pagename):
+        return _('You are not allowed to overwrite a file attachment of this page.')
+
     filename = form.get('file__filename__')
     rename = form.get('rename', [u''])[0].strip()
     if rename: