changeset 606:f31f1327c1e9

Fixed journal action loggin doubled messages.
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 18 Oct 2010 03:39:16 +0200
parents 72bed56219d6
children ff449e9e6e38
files rhodecode/lib/middleware/simplehg.py
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/middleware/simplehg.py	Mon Oct 18 03:06:38 2010 +0200
+++ b/rhodecode/lib/middleware/simplehg.py	Mon Oct 18 03:39:16 2010 +0200
@@ -101,11 +101,12 @@
                                                     (user, repo_name):
                     return HTTPForbidden()(environ, start_response)
 
-            #log action    
-            proxy_key = 'HTTP_X_REAL_IP'
-            def_key = 'REMOTE_ADDR'
-            ipaddr = environ.get(proxy_key, environ.get(def_key, '0.0.0.0'))
-            self.__log_user_action(user, action, repo_name, ipaddr)
+            #log action
+            if action in ('push', 'pull', 'clone'):
+                proxy_key = 'HTTP_X_REAL_IP'
+                def_key = 'REMOTE_ADDR'
+                ipaddr = environ.get(proxy_key, environ.get(def_key, '0.0.0.0'))
+                self.__log_user_action(user, action, repo_name, ipaddr)
 
         #===================================================================
         # MERCURIAL REQUEST HANDLING
@@ -165,14 +166,14 @@
 
     def __get_action(self, environ):
         """
-        Maps mercurial request commands into a pull or push command.
-        This should return generally always something
+        Maps mercurial request commands into a clone,pull or push command.
+        This should always return a valid command string
         :param environ:
         """
         mapping = {'changegroup': 'pull',
                    'changegroupsubset': 'pull',
                    'stream_out': 'pull',
-                   'listkeys': 'pull',
+                   #'listkeys': 'pull',
                    'unbundle': 'push',
                    'pushkey': 'push', }
         for qry in environ['QUERY_STRING'].split('&'):