Changeset - 04ace15a511e
[Not reviewed]
default
0 3 0
Mads Kiilerich - 7 years ago 2019-01-08 13:02:44
mads@kiilerich.com
middleware: introduce more generic VCS webob.exc.HTTPException exception handling
3 files changed with 7 insertions and 8 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/base.py
Show inline comments
 
@@ -308,6 +308,8 @@ class BaseVCSController(object):
 
            if parsed_request is None:
 
                return self.application(environ, start_response)
 
            return self._handle_request(parsed_request, environ, start_response)
 
        except webob.exc.HTTPException as e:
 
            return e(environ, start_response)
 
        finally:
 
            log = logging.getLogger('kallithea.' + self.__class__.__name__)
 
            log.debug('Request time: %.3fs', time.time() - start)
kallithea/lib/middleware/simplegit.py
Show inline comments
 
@@ -71,7 +71,7 @@ class SimpleGit(BaseVCSController):
 

	
 
        # quick check if repo exists...
 
        if not is_valid_repo(parsed_request.repo_name, self.basepath, 'git'):
 
            return HTTPNotFound()(environ, start_response)
 
            raise HTTPNotFound()
 

	
 
        #======================================================================
 
        # GET ACTION PULL or PUSH
 
@@ -114,7 +114,7 @@ class SimpleGit(BaseVCSController):
 
            return app(environ, start_response)
 
        except Exception:
 
            log.error(traceback.format_exc())
 
            return HTTPInternalServerError()(environ, start_response)
 
            raise HTTPInternalServerError()
 

	
 
    def __make_app(self, repo_name):
 
        """
kallithea/lib/middleware/simplehg.py
Show inline comments
 
@@ -86,15 +86,12 @@ class SimpleHg(BaseVCSController):
 

	
 
        # quick check if repo exists...
 
        if not is_valid_repo(parsed_request.repo_name, self.basepath, 'hg'):
 
            return HTTPNotFound()(environ, start_response)
 
            raise HTTPNotFound()
 

	
 
        #======================================================================
 
        # GET ACTION PULL or PUSH
 
        #======================================================================
 
        try:
 
            action = self.__get_action(environ)
 
        except HTTPBadRequest as e:
 
            return e(environ, start_response)
 
        action = self.__get_action(environ)
 

	
 
        #======================================================================
 
        # CHECK PERMISSIONS
 
@@ -135,7 +132,7 @@ class SimpleHg(BaseVCSController):
 
            return app(environ, start_response)
 
        except Exception:
 
            log.error(traceback.format_exc())
 
            return HTTPInternalServerError()(environ, start_response)
 
            raise HTTPInternalServerError()
 

	
 
    def __make_app(self, repo_name, baseui):
 
        """
0 comments (0 inline, 0 general)