Mercurial > kallithea
comparison 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 |
comparison
equal
deleted
inserted
replaced
4011:4959e22af6ca | 4012:55dbc440878b |
---|---|
53 from rhodecode.model import meta | 53 from rhodecode.model import meta |
54 from rhodecode.model.db import Repository, User, RhodeCodeUi, \ | 54 from rhodecode.model.db import Repository, User, RhodeCodeUi, \ |
55 UserLog, RepoGroup, RhodeCodeSetting, CacheInvalidation, UserGroup | 55 UserLog, RepoGroup, RhodeCodeSetting, CacheInvalidation, UserGroup |
56 from rhodecode.model.meta import Session | 56 from rhodecode.model.meta import Session |
57 from rhodecode.model.repos_group import ReposGroupModel | 57 from rhodecode.model.repos_group import ReposGroupModel |
58 from rhodecode.lib.utils2 import safe_str, safe_unicode | 58 from rhodecode.lib.utils2 import safe_str, safe_unicode, get_current_rhodecode_user |
59 from rhodecode.lib.vcs.utils.fakemod import create_module | 59 from rhodecode.lib.vcs.utils.fakemod import create_module |
60 from rhodecode.model.users_group import UserGroupModel | 60 from rhodecode.model.users_group import UserGroupModel |
61 | 61 |
62 log = logging.getLogger(__name__) | 62 log = logging.getLogger(__name__) |
63 | 63 |
148 | 148 |
149 if not sa: | 149 if not sa: |
150 sa = meta.Session() | 150 sa = meta.Session() |
151 # if we don't get explicit IP address try to get one from registered user | 151 # if we don't get explicit IP address try to get one from registered user |
152 # in tmpl context var | 152 # in tmpl context var |
153 from pylons import tmpl_context | 153 if not ipaddr: |
154 if not ipaddr and hasattr(tmpl_context, 'rhodecode_user'): | 154 ipaddr = getattr(get_current_rhodecode_user(), 'ip_addr', '') |
155 ipaddr = tmpl_context.rhodecode_user.ip_addr | |
156 | 155 |
157 try: | 156 try: |
158 if hasattr(user, 'user_id'): | 157 if hasattr(user, 'user_id'): |
159 user_obj = User.get(user.user_id) | 158 user_obj = User.get(user.user_id) |
160 elif isinstance(user, basestring): | 159 elif isinstance(user, basestring): |