Mercurial > kallithea
comparison rhodecode/lib/base.py @ 2490:7a5eeafb1a9a beta
better path extraction method.
fixed error document old html
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 20 Jun 2012 00:01:06 +0200 |
parents | 6f537e3da9c4 |
children | f0851f37d6be |
comparison
equal
deleted
inserted
replaced
2489:a0adf8db1416 | 2490:7a5eeafb1a9a |
---|---|
44 if ip: | 44 if ip: |
45 return ip | 45 return ip |
46 | 46 |
47 ip = environ.get(def_key, '0.0.0.0') | 47 ip = environ.get(def_key, '0.0.0.0') |
48 return ip | 48 return ip |
49 | |
50 | |
51 def _get_access_path(environ): | |
52 path = environ.get('PATH_INFO') | |
53 org_req = environ.get('pylons.original_request') | |
54 if org_req: | |
55 path = org_req.environ.get('PATH_INFO') | |
56 return path | |
49 | 57 |
50 | 58 |
51 class BasicAuth(AuthBasicAuthenticator): | 59 class BasicAuth(AuthBasicAuthenticator): |
52 | 60 |
53 def __init__(self, realm, authfunc, auth_http_code=None): | 61 def __init__(self, realm, authfunc, auth_http_code=None): |
185 self.rhodecode_user.user_id is not None: | 193 self.rhodecode_user.user_id is not None: |
186 self.rhodecode_user.set_authenticated( | 194 self.rhodecode_user.set_authenticated( |
187 cookie_store.get('is_authenticated') | 195 cookie_store.get('is_authenticated') |
188 ) | 196 ) |
189 log.info('IP: %s User: %s accessed %s' % ( | 197 log.info('IP: %s User: %s accessed %s' % ( |
190 self.ip_addr, auth_user, safe_unicode(environ.get('PATH_INFO'))) | 198 self.ip_addr, auth_user, safe_unicode(_get_access_path(environ))) |
191 ) | 199 ) |
192 return WSGIController.__call__(self, environ, start_response) | 200 return WSGIController.__call__(self, environ, start_response) |
193 finally: | 201 finally: |
194 log.info('IP: %s Request to %s time: %.3fs' % ( | 202 log.info('IP: %s Request to %s time: %.3fs' % ( |
195 _get_ip_addr(environ), | 203 _get_ip_addr(environ), |
196 safe_unicode(environ.get('PATH_INFO')), time.time() - start) | 204 safe_unicode(_get_access_path(environ)), time.time() - start) |
197 ) | 205 ) |
198 meta.Session.remove() | 206 meta.Session.remove() |
199 | 207 |
200 | 208 |
201 class BaseRepoController(BaseController): | 209 class BaseRepoController(BaseController): |