changeset 6071:751214fa01d7

use proper argument, pagename, in call to log_attempt()
author 'Karl O. Pinc' <kop@meme.com>
date Mon, 15 Sep 2014 21:00:41 -0500
parents 2e0530a78920
children eeb0a608382d
files MoinMoin/PageEditor.py MoinMoin/action/newpage.py MoinMoin/action/revert.py MoinMoin/wsgiapp.py
diffstat 4 files changed, 19 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/PageEditor.py	Mon Sep 15 20:48:41 2014 -0500
+++ b/MoinMoin/PageEditor.py	Mon Sep 15 21:00:41 2014 -0500
@@ -169,10 +169,11 @@
 
         # check edit permissions
         if not request.user.may.write(self.page_name):
-            log_attempt('edit: edit', False, request, name=self.page_name)
+            log_attempt('edit: edit', False, request, pagename=self.page_name)
             msg = _('You are not allowed to edit this page.')
         elif not self.isWritable():
-            log_attempt('edit: immutable', False, request, name=self.page_name)
+            log_attempt('edit: immutable', False, request,
+                        pagename=self.page_name)
             msg = _('Page is immutable!')
         elif self.rev:
             # Trying to edit an old version, this is not possible via
@@ -554,7 +555,7 @@
             return False, _("You can't copy to an empty pagename.")
 
         if not self.request.user.may.write(newpagename):
-            log_attempt('edit: copy', False, request, name=self.page_name)
+            log_attempt('edit: copy', False, request, pagename=self.page_name)
             return False, _('You are not allowed to copy this page!')
 
         newpage = PageEditor(request, newpagename)
@@ -607,7 +608,8 @@
 
         if not (request.user.may.delete(self.page_name)
                 and request.user.may.write(newpagename)):
-            log_attempt('edit: rename', False, request, name=self.page_name)
+            log_attempt('edit: rename', False, request,
+                        pagename=self.page_name)
             msg = _('You are not allowed to rename this page!')
             raise self.AccessDenied(msg)
 
@@ -715,7 +717,8 @@
         success = True
         if not (request.user.may.write(self.page_name)
                 and request.user.may.delete(self.page_name)):
-            log_attempt('edit: delete', False, request, name=self.page_name)
+            log_attempt('edit: delete', False, request,
+                        pagename=self.page_name)
             msg = _('You are not allowed to delete this page!')
             raise self.AccessDenied(msg)
 
@@ -1080,11 +1083,12 @@
 
         msg = ""
         if not request.user.may.save(self, newtext, rev, **kw):
-            log_attempt('edit: edit', False, request, name=self.page_name)
+            log_attempt('edit: edit', False, request, pagename=self.page_name)
             msg = _('You are not allowed to edit this page!')
             raise self.AccessDenied(msg)
         elif not self.isWritable():
-            log_attempt('edit: immutable', False, request, name=self.page_name)
+            log_attempt('edit: immutable', False, request,
+                        pagename=self.page_name)
             msg = _('Page is immutable!')
             raise self.Immutable(msg)
         elif not newtext:
@@ -1128,7 +1132,8 @@
             if (not request.user.may.admin(self.page_name) and
                 parseACL(request, newtext).acl != acl.acl and
                 action != "SAVE/REVERT"):
-                log_attempt('edit: acl', False, request, name=self.page_name)
+                log_attempt('edit: acl', False, request,
+                            pagename=self.page_name)
                 msg = _("You can't change ACLs on this page since you have no admin rights on it!")
                 raise self.NoAdmin(msg)
 
--- a/MoinMoin/action/newpage.py	Mon Sep 15 20:48:41 2014 -0500
+++ b/MoinMoin/action/newpage.py	Mon Sep 15 21:00:41 2014 -0500
@@ -66,7 +66,7 @@
         page = Page(self.request, self.pagename)
         if not (page.isWritable() and self.request.user.may.read(self.pagename)):
             # Same error as the edit page for localization reasons
-            log_attempt('newpage', False, self.request, page=self.pagename)
+            log_attempt('newpage', False, self.request, pagename=self.pagename)
             return _('You are not allowed to edit this page.')
         return ''
 
--- a/MoinMoin/action/revert.py	Mon Sep 15 20:48:41 2014 -0500
+++ b/MoinMoin/action/revert.py	Mon Sep 15 21:00:41 2014 -0500
@@ -34,7 +34,7 @@
         may = self.request.user.may
         allowed = may.write(self.pagename) and may.revert(self.pagename)
         if not allowed:
-            log_attempt('revert', False, self.request, page=self.pagename)
+            log_attempt('revert', False, self.request, pagename=self.pagename)
         return allowed, _('You are not allowed to revert this page!')
 
     def check_condition(self):
--- a/MoinMoin/wsgiapp.py	Mon Sep 15 20:48:41 2014 -0500
+++ b/MoinMoin/wsgiapp.py	Mon Sep 15 21:00:41 2014 -0500
@@ -175,9 +175,9 @@
                 'action_name': wikiutil.escape(action_name), }
         if context.user.valid:
             log_attempt(action_name, False, request,
-                        context.user.name, page=pagename)
+                        context.user.name, pagename=pagename)
         else:
-            log_attempt(action_name, False, request, page=pagename)
+            log_attempt(action_name, False, request, pagename=pagename)
             # Suggest non valid user to login
             msg += " " + _("Login and try again.")
 
@@ -193,9 +193,9 @@
                     'action_name': wikiutil.escape(action_name), }
             if context.user.valid:
                 log_attempt(action_name, False, request,
-                            context.user.name, page=pagename)
+                            context.user.name, pagename=pagename)
             else:
-                log_attempt(action_name, False, request, page=pagename)
+                log_attempt(action_name, False, request, pagename=pagename)
                 # Suggest non valid user to login
                 msg += " " + _("Login and try again.")
             context.theme.add_msg(msg, "error")