changeset 1991:a51db06be0bd

Load: only exists and overwrite need to test for delete rights
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 15 Apr 2007 09:19:44 +0200
parents 9051a3a23124
children c4bfc16a6081
files MoinMoin/action/Load.py
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/Load.py	Sat Apr 14 14:02:14 2007 +0200
+++ b/MoinMoin/action/Load.py	Sun Apr 15 09:19:44 2007 +0200
@@ -66,14 +66,15 @@
                          'target': target, 'filename': filename}
                 return status, msg
 
-            if exists and self.request.user.may.delete(self.pagename):
-                try:
-                    os.remove(fpath)
-                except:
-                    pass
-            else:
-                msg = _("You are not allowed to delete attachments on this page.")
-                return status, msg
+            if exists and overwrite:
+                if self.request.user.may.delete(self.pagename):
+                    try:
+                        os.remove(fpath)
+                    except:
+                        pass
+                else:
+                    msg = _("You are not allowed to delete attachments on this page.")
+                    return status, msg
 
             AttachFile.add_attachment(self.request, self.pagename, target, filecontent)
             bytes = len(filecontent)