Changeset - d0e477b5dc95
[Not reviewed]
default
0 2 0
Marcin Kuzminski - 14 years ago 2012-01-06 05:09:12
marcin@python-works.com
backported fixes for issue #318
- session cleanup for mercurial and git middlewares
2 files changed with 22 insertions and 0 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/middleware/simplegit.py
Show inline comments
 
@@ -27,6 +27,7 @@
 
import os
 
import logging
 
import traceback
 
import time
 

	
 
from dulwich import server as dulserver
 

	
 
@@ -72,6 +73,7 @@ from paste.httpheaders import REMOTE_USE
 
from rhodecode.lib import safe_str
 
from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware
 
from rhodecode.lib.utils import invalidate_cache, is_valid_repo
 
from rhodecode.model import meta
 
from rhodecode.model.db import User
 

	
 
from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError
 
@@ -102,6 +104,15 @@ class SimpleGit(object):
 
        self.authenticate = AuthBasicAuthenticator('', authfunc)
 

	
 
    def __call__(self, environ, start_response):
 
        start = time.time()
 
        try:
 
            return self._handle_request(environ, start_response)
 
        finally:
 
            log = logging.getLogger(self.__class__.__name__)
 
            log.debug('Request time: %.3fs' % (time.time() - start))
 
            meta.Session.remove()
 

	
 
    def _handle_request(self, environ, start_response):
 
        if not is_git(environ):
 
            return self.application(environ, start_response)
 

	
rhodecode/lib/middleware/simplehg.py
Show inline comments
 
@@ -27,6 +27,7 @@
 
import os
 
import logging
 
import traceback
 
import time
 

	
 
from mercurial.error import RepoError
 
from mercurial.hgweb import hgweb_mod
 
@@ -38,6 +39,7 @@ from rhodecode.lib import safe_str
 
from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware
 
from rhodecode.lib.utils import make_ui, invalidate_cache, \
 
    is_valid_repo, ui_sections
 
from rhodecode.model import meta
 
from rhodecode.model.db import User
 

	
 
from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError
 
@@ -67,6 +69,15 @@ class SimpleHg(object):
 
        self.ipaddr = '0.0.0.0'
 

	
 
    def __call__(self, environ, start_response):
 
        start = time.time()
 
        try:
 
            return self._handle_request(environ, start_response)
 
        finally:
 
            log = logging.getLogger(self.__class__.__name__)
 
            log.debug('Request time: %.3fs' % (time.time() - start))
 
            meta.Session.remove()
 

	
 
    def _handle_request(self, environ, start_response):
 
        if not is_mercurial(environ):
 
            return self.application(environ, start_response)
 

	
0 comments (0 inline, 0 general)