Mercurial > kallithea
diff rhodecode/lib/middleware/simplegit.py @ 2500:94ef0b609d17 beta
possible fix for #486 undefined variable username
- cleaned a code on git/hg middleware
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 21 Jun 2012 17:48:41 +0200 |
parents | 6af1e0d5ff9d |
children | d24c70ec9312 |
line wrap: on
line diff
--- a/rhodecode/lib/middleware/simplegit.py Thu Jun 21 01:34:11 2012 +0200 +++ b/rhodecode/lib/middleware/simplegit.py Thu Jun 21 17:48:41 2012 +0200 @@ -167,21 +167,20 @@ #============================================================== # CHECK PERMISSIONS FOR THIS REQUEST USING GIVEN USERNAME #============================================================== - if action in ['pull', 'push']: - try: - user = self.__get_user(username) - if user is None or not user.active: - return HTTPForbidden()(environ, start_response) - username = user.username - except: - log.error(traceback.format_exc()) - return HTTPInternalServerError()(environ, - start_response) + try: + user = self.__get_user(username) + if user is None or not user.active: + return HTTPForbidden()(environ, start_response) + username = user.username + except: + log.error(traceback.format_exc()) + return HTTPInternalServerError()(environ, start_response) - #check permissions for this repository - perm = self._check_permission(action, user, repo_name) - if perm is not True: - return HTTPForbidden()(environ, start_response) + #check permissions for this repository + perm = self._check_permission(action, user, repo_name) + if perm is not True: + return HTTPForbidden()(environ, start_response) + extras = { 'ip': ipaddr, 'username': username,