comparison rhodecode/lib/middleware/simplegit.py @ 2122:c137b8a81f8e beta

git+hg middleware do repo verification at earliest possible state, giving 404 as fast as possible. If repo is not found.
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 12 Mar 2012 20:33:13 +0200
parents 8ecfed1d8f8b
children 46b67235a8f0
comparison
equal deleted inserted replaced
2121:47d7bcbe5503 2122:c137b8a81f8e
113 repo_name = self.__get_repository(environ) 113 repo_name = self.__get_repository(environ)
114 log.debug('Extracted repo name is %s' % repo_name) 114 log.debug('Extracted repo name is %s' % repo_name)
115 except: 115 except:
116 return HTTPInternalServerError()(environ, start_response) 116 return HTTPInternalServerError()(environ, start_response)
117 117
118 # quick check if that dir exists...
119 if is_valid_repo(repo_name, self.basepath) is False:
120 return HTTPNotFound()(environ, start_response)
121
118 #====================================================================== 122 #======================================================================
119 # GET ACTION PULL or PUSH 123 # GET ACTION PULL or PUSH
120 #====================================================================== 124 #======================================================================
121 action = self.__get_action(environ) 125 action = self.__get_action(environ)
122 126
178 #=================================================================== 182 #===================================================================
179 # GIT REQUEST HANDLING 183 # GIT REQUEST HANDLING
180 #=================================================================== 184 #===================================================================
181 repo_path = os.path.join(safe_str(self.basepath), safe_str(repo_name)) 185 repo_path = os.path.join(safe_str(self.basepath), safe_str(repo_name))
182 log.debug('Repository path is %s' % repo_path) 186 log.debug('Repository path is %s' % repo_path)
183
184 # quick check if that dir exists...
185 if is_valid_repo(repo_name, self.basepath) is False:
186 return HTTPNotFound()(environ, start_response)
187 187
188 try: 188 try:
189 #invalidate cache on push 189 #invalidate cache on push
190 if action == 'push': 190 if action == 'push':
191 self._invalidate_cache(repo_name) 191 self._invalidate_cache(repo_name)