[Moin-devel] CVS: MoinMoin config.py,1.53,1.54 eventlog.py,1.5,1.6

J?rgen Hermann jhermann at users.sourceforge.net
Thu Feb 7 03:57:02 EST 2002


Update of /cvsroot/moin/MoinMoin
In directory usw-pr-cvs1:/tmp/cvs-serv15818

Modified Files:
	config.py eventlog.py 
Log Message:
Don't log spider accesses


Index: config.py
===================================================================
RCS file: /cvsroot/moin/MoinMoin/config.py,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -r1.53 -r1.54
*** config.py	2 Feb 2002 01:03:47 -0000	1.53
--- config.py	7 Feb 2002 11:56:15 -0000	1.54
***************
*** 173,176 ****
--- 173,177 ----
      'title2': '<hr>',
      'trail_size': 5,
+     'ua_spiders': 'htdig', # a regex of HTTP_USER_AGENTS that should be excluded from logging
      'umask': 0777,
      'upperletters': 'A-Z\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd2\xd3\xd4\xd5\xd6\xd8\xd9\xda\xdb\xdc\xdd\xc7\xd0\xd1\xde',

Index: eventlog.py
===================================================================
RCS file: /cvsroot/moin/MoinMoin/eventlog.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** eventlog.py	7 Feb 2002 11:37:34 -0000	1.5
--- eventlog.py	7 Feb 2002 11:56:15 -0000	1.6
***************
*** 27,30 ****
--- 27,34 ----
      def __init__(self):
          self._logfile = None
+         self._ua_match = None
+         if config.ua_spiders:
+             import re
+             self._ua_match = re.compile(config.ua_spiders)
  
      def _write(self, data):
***************
*** 38,41 ****
--- 42,48 ----
              pairs appended (i.e. you have to pass a dict).
          """
+         if self._ua_match and self._ua_match.search(os.environ.get('HTTP_USER_AGENT', '')):
+             return
+ 
          kvlist = values.items()
          if add_http_info:





More information about the Moin-devel mailing list