Mercurial > kallithea
diff rhodecode/lib/middleware/simplegit.py @ 756:01be209b9828 beta
project refactoring, cleaned up lib.utils from rarly used functions, and place them
in proper controllers
moves is_git is_hg functions to the middleware classes
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 25 Nov 2010 01:57:37 +0100 |
parents | 070f32743632 |
children | 9c4851dce8e6 a3b2b4b4e440 |
line wrap: on
line diff
--- a/rhodecode/lib/middleware/simplegit.py Thu Nov 25 01:53:31 2010 +0100 +++ b/rhodecode/lib/middleware/simplegit.py Thu Nov 25 01:57:37 2010 +0100 @@ -63,7 +63,7 @@ from paste.auth.basic import AuthBasicAuthenticator from paste.httpheaders import REMOTE_USER, AUTH_TYPE from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware -from rhodecode.lib.utils import is_git, invalidate_cache, check_repo_fast +from rhodecode.lib.utils import invalidate_cache, check_repo_fast from rhodecode.model.user import UserModel from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError import logging @@ -72,6 +72,18 @@ log = logging.getLogger(__name__) +def is_git(environ): + """ + Returns True if request's target is git server. ``HTTP_USER_AGENT`` would + then have git client version given. + + :param environ: + """ + http_user_agent = environ.get('HTTP_USER_AGENT') + if http_user_agent and http_user_agent.startswith('git'): + return True + return False + class SimpleGit(object): def __init__(self, application, config):