changeset 5494:9241bdfaeb6d

use ip address in edit-lock in any case (without IP, edit-lock can't be released for anon editors)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 05 Feb 2010 15:22:54 +0100
parents 91aa8c3c515b
children da4384535256 e3a12f263823
files MoinMoin/PageEditor.py MoinMoin/logfile/editlog.py
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/PageEditor.py	Wed Feb 03 13:37:38 2010 +0100
+++ b/MoinMoin/PageEditor.py	Fri Feb 05 15:22:54 2010 +0100
@@ -1296,7 +1296,7 @@
         """ Write new lock file. """
         self._deleteLockFile()
         try:
-            editlog.EditLog(self.request, filename=self._filename()).add(
+            editlog.EditLog(self.request, filename=self._filename(), force_ip=True).add(
                self.request, wikiutil.timestamp2version(self.now), 0, "LOCK", self.page_name)
         except IOError:
             pass
--- a/MoinMoin/logfile/editlog.py	Wed Feb 03 13:37:38 2010 +0100
+++ b/MoinMoin/logfile/editlog.py	Fri Feb 05 15:22:54 2010 +0100
@@ -163,12 +163,16 @@
         # of a confusing userid
         self.uid_override = kw.get('uid_override', None)
 
+        # force inclusion of ip address, even if config forbids it.
+        # this is needed so PageLock can work correctly for locks of anon editors.
+        self.force_ip = kw.get('force_ip', False)
+
     def add(self, request, mtime, rev, action, pagename, host=None, extra=u'', comment=u''):
         """ Generate (and add) a line to the edit-log.
 
         If `host` is None, it's read from request vars.
         """
-        if request.cfg.log_remote_addr:
+        if request.cfg.log_remote_addr or self.force_ip:
             if host is None:
                 host = request.remote_addr