changeset 838:910ed4667859

cfg.log_reverse_dns_lookups = False for disabling reverse dns lookup on networks with broken rdns
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 15 Jun 2006 23:34:14 +0200
parents 7abe5a3e5e8c
children 715171e93d79 71875396f812
files MoinMoin/logfile/editlog.py MoinMoin/multiconfig.py docs/CHANGES
diffstat 3 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/logfile/editlog.py	Thu Jun 15 21:11:18 2006 +0200
+++ b/MoinMoin/logfile/editlog.py	Thu Jun 15 23:34:14 2006 +0200
@@ -143,17 +143,19 @@
     
             If `host` is None, it's read from request vars.
             """
-            import socket
-            
             if host is None:
                 host = request.remote_addr
-                
-            try:
-                hostname = socket.gethostbyaddr(host)[0]
-                hostname = unicode(hostname, config.charset)
-            except (socket.error, UnicodeError), err:
+
+            if request.cfg.log_reverse_dns_lookups:
+                import socket
+                try:
+                    hostname = socket.gethostbyaddr(host)[0]
+                    hostname = unicode(hostname, config.charset)
+                except (socket.error, UnicodeError), err:
+                    hostname = host
+            else:
                 hostname = host
-
+            
             remap_chars = {u'\t': u' ', u'\r': u' ', u'\n': u' ',}
             comment = comment.translate(remap_chars)
             user_id = request.user.valid and request.user.id or ''
--- a/MoinMoin/multiconfig.py	Thu Jun 15 21:11:18 2006 +0200
+++ b/MoinMoin/multiconfig.py	Thu Jun 15 23:34:14 2006 +0200
@@ -272,6 +272,9 @@
     language_ignore_browser = False # ignore browser settings, use language_default
                                     # or user prefs
 
+    log_reverse_dns_lookups = True  # if we do reverse dns lookups for logging hostnames
+                                    # instead of just IPs
+
     xapian_search = False # disabled until xapian is finished
 
     mail_login = None # or "user pwd" if you need to use SMTP AUTH
--- a/docs/CHANGES	Thu Jun 15 21:11:18 2006 +0200
+++ b/docs/CHANGES	Thu Jun 15 23:34:14 2006 +0200
@@ -140,6 +140,9 @@
       To use TLS/SSL support you must also install the TLSLite library
       (http://trevp.net/tlslite/). Version 0.3.8 was used for development and
       testing.
+    * cfg.log_reverse_dns_lookups [default: True] - you can set this to False
+      if rev. dns lookups are broken in your network (leading to long delays
+      on page saves). With False, edit-log will only contain IP, not hostname.
 
   Bugfixes:
     * on action "info" page, "revert" link will not be displayed for empty page