diff rhodecode/lib/utils.py @ 4012:55dbc440878b

Fixed bug with log_delete hook didn't properly store user who triggered delete action
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 18 Jun 2013 02:06:01 +0200
parents 5ee341209d7f
children ffd45b185016
line wrap: on
line diff
--- a/rhodecode/lib/utils.py	Tue Jun 18 01:45:46 2013 +0200
+++ b/rhodecode/lib/utils.py	Tue Jun 18 02:06:01 2013 +0200
@@ -55,7 +55,7 @@
     UserLog, RepoGroup, RhodeCodeSetting, CacheInvalidation, UserGroup
 from rhodecode.model.meta import Session
 from rhodecode.model.repos_group import ReposGroupModel
-from rhodecode.lib.utils2 import safe_str, safe_unicode
+from rhodecode.lib.utils2 import safe_str, safe_unicode, get_current_rhodecode_user
 from rhodecode.lib.vcs.utils.fakemod import create_module
 from rhodecode.model.users_group import UserGroupModel
 
@@ -150,9 +150,8 @@
         sa = meta.Session()
     # if we don't get explicit IP address try to get one from registered user
     # in tmpl context var
-    from pylons import tmpl_context
-    if not ipaddr and hasattr(tmpl_context, 'rhodecode_user'):
-        ipaddr = tmpl_context.rhodecode_user.ip_addr
+    if not ipaddr:
+        ipaddr = getattr(get_current_rhodecode_user(), 'ip_addr', '')
 
     try:
         if hasattr(user, 'user_id'):