Mercurial > kallithea
comparison rhodecode/lib/middleware/simplegit.py @ 2057:766696ee9487 beta
let the is_git method exists so it is more similar to the hg backend.
author | Tony Bussieres <t.bussieres@gmail.com> |
---|---|
date | Mon, 27 Feb 2012 18:15:39 -0800 |
parents | 851ea1139169 |
children | fb51a6fc10ae |
comparison
equal
deleted
inserted
replaced
2056:851ea1139169 | 2057:766696ee9487 |
---|---|
80 log = logging.getLogger(__name__) | 80 log = logging.getLogger(__name__) |
81 | 81 |
82 | 82 |
83 GIT_PROTO_PAT = re.compile(r'git-upload-pack|git-receive-pack|info\/refs') | 83 GIT_PROTO_PAT = re.compile(r'git-upload-pack|git-receive-pack|info\/refs') |
84 | 84 |
85 def is_git(action): | |
86 return action in ['pull','push'] | |
85 | 87 |
86 class SimpleGit(BaseVCSController): | 88 class SimpleGit(BaseVCSController): |
87 | 89 |
88 def _handle_request(self, environ, start_response): | 90 def _handle_request(self, environ, start_response): |
89 #====================================================================== | 91 #====================================================================== |
90 # GET ACTION PULL or PUSH | 92 # GET ACTION PULL or PUSH |
91 #====================================================================== | 93 #====================================================================== |
92 action = self.__get_action(environ) | 94 action = self.__get_action(environ) |
93 | 95 |
94 if not action in ['pull','push']: | 96 if not is_git(action): |
95 return self.application(environ, start_response) | 97 return self.application(environ, start_response) |
96 | 98 |
97 proxy_key = 'HTTP_X_REAL_IP' | 99 proxy_key = 'HTTP_X_REAL_IP' |
98 def_key = 'REMOTE_ADDR' | 100 def_key = 'REMOTE_ADDR' |
99 ipaddr = environ.get(proxy_key, environ.get(def_key, '0.0.0.0')) | 101 ipaddr = environ.get(proxy_key, environ.get(def_key, '0.0.0.0')) |