Mercurial > kallithea
comparison 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 |
comparison
equal
deleted
inserted
replaced
755:99ece4c484e1 | 756:01be209b9828 |
---|---|
61 from dulwich.repo import Repo | 61 from dulwich.repo import Repo |
62 from dulwich.web import HTTPGitApplication | 62 from dulwich.web import HTTPGitApplication |
63 from paste.auth.basic import AuthBasicAuthenticator | 63 from paste.auth.basic import AuthBasicAuthenticator |
64 from paste.httpheaders import REMOTE_USER, AUTH_TYPE | 64 from paste.httpheaders import REMOTE_USER, AUTH_TYPE |
65 from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware | 65 from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware |
66 from rhodecode.lib.utils import is_git, invalidate_cache, check_repo_fast | 66 from rhodecode.lib.utils import invalidate_cache, check_repo_fast |
67 from rhodecode.model.user import UserModel | 67 from rhodecode.model.user import UserModel |
68 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError | 68 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError |
69 import logging | 69 import logging |
70 import os | 70 import os |
71 import traceback | 71 import traceback |
72 | 72 |
73 log = logging.getLogger(__name__) | 73 log = logging.getLogger(__name__) |
74 | |
75 def is_git(environ): | |
76 """ | |
77 Returns True if request's target is git server. ``HTTP_USER_AGENT`` would | |
78 then have git client version given. | |
79 | |
80 :param environ: | |
81 """ | |
82 http_user_agent = environ.get('HTTP_USER_AGENT') | |
83 if http_user_agent and http_user_agent.startswith('git'): | |
84 return True | |
85 return False | |
74 | 86 |
75 class SimpleGit(object): | 87 class SimpleGit(object): |
76 | 88 |
77 def __init__(self, application, config): | 89 def __init__(self, application, config): |
78 self.application = application | 90 self.application = application |