Mercurial > kallithea
comparison 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 |
comparison
equal
deleted
inserted
replaced
2499:c919d8c4f6a2 | 2500:94ef0b609d17 |
---|---|
165 return result.wsgi_application(environ, start_response) | 165 return result.wsgi_application(environ, start_response) |
166 | 166 |
167 #============================================================== | 167 #============================================================== |
168 # CHECK PERMISSIONS FOR THIS REQUEST USING GIVEN USERNAME | 168 # CHECK PERMISSIONS FOR THIS REQUEST USING GIVEN USERNAME |
169 #============================================================== | 169 #============================================================== |
170 if action in ['pull', 'push']: | 170 try: |
171 try: | 171 user = self.__get_user(username) |
172 user = self.__get_user(username) | 172 if user is None or not user.active: |
173 if user is None or not user.active: | |
174 return HTTPForbidden()(environ, start_response) | |
175 username = user.username | |
176 except: | |
177 log.error(traceback.format_exc()) | |
178 return HTTPInternalServerError()(environ, | |
179 start_response) | |
180 | |
181 #check permissions for this repository | |
182 perm = self._check_permission(action, user, repo_name) | |
183 if perm is not True: | |
184 return HTTPForbidden()(environ, start_response) | 173 return HTTPForbidden()(environ, start_response) |
174 username = user.username | |
175 except: | |
176 log.error(traceback.format_exc()) | |
177 return HTTPInternalServerError()(environ, start_response) | |
178 | |
179 #check permissions for this repository | |
180 perm = self._check_permission(action, user, repo_name) | |
181 if perm is not True: | |
182 return HTTPForbidden()(environ, start_response) | |
183 | |
185 extras = { | 184 extras = { |
186 'ip': ipaddr, | 185 'ip': ipaddr, |
187 'username': username, | 186 'username': username, |
188 'action': action, | 187 'action': action, |
189 'repository': repo_name, | 188 'repository': repo_name, |