comparison rhodecode/lib/middleware/simplegit.py @ 4186:7e5f8c12a3fc kallithea-2.2.5-rebrand

First step in two-part process to rename directories to kallithea. This first step is to change all references in the files where they refer to the old directory name.
author Bradley M. Kuhn <bkuhn@sfconservancy.org>
date Wed, 02 Jul 2014 19:04:28 -0400
parents ffd45b185016
children
comparison
equal deleted inserted replaced
4185:aaa7c3331186 4186:7e5f8c12a3fc
10 # GNU General Public License for more details. 10 # GNU General Public License for more details.
11 # 11 #
12 # You should have received a copy of the GNU General Public License 12 # You should have received a copy of the GNU General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>. 13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 """ 14 """
15 rhodecode.lib.middleware.simplegit 15 kallithea.lib.middleware.simplegit
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17 17
18 SimpleGit middleware for handling git protocol request (push/clone etc.) 18 SimpleGit middleware for handling git protocol request (push/clone etc.)
19 It's implemented with basic auth function 19 It's implemented with basic auth function
20 20
32 import traceback 32 import traceback
33 33
34 from paste.httpheaders import REMOTE_USER, AUTH_TYPE 34 from paste.httpheaders import REMOTE_USER, AUTH_TYPE
35 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError, \ 35 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError, \
36 HTTPNotAcceptable 36 HTTPNotAcceptable
37 from rhodecode.model.db import User, RhodeCodeUi 37 from kallithea.model.db import User, RhodeCodeUi
38 38
39 from rhodecode.lib.utils2 import safe_str, fix_PATH, get_server_url,\ 39 from kallithea.lib.utils2 import safe_str, fix_PATH, get_server_url,\
40 _set_extras 40 _set_extras
41 from rhodecode.lib.base import BaseVCSController 41 from kallithea.lib.base import BaseVCSController
42 from rhodecode.lib.utils import make_ui, is_valid_repo 42 from kallithea.lib.utils import make_ui, is_valid_repo
43 from rhodecode.lib.exceptions import HTTPLockedRC 43 from kallithea.lib.exceptions import HTTPLockedRC
44 from rhodecode.lib.hooks import pre_pull 44 from kallithea.lib.hooks import pre_pull
45 from rhodecode.lib import auth_modules 45 from kallithea.lib import auth_modules
46 46
47 log = logging.getLogger(__name__) 47 log = logging.getLogger(__name__)
48 48
49 49
50 GIT_PROTO_PAT = re.compile(r'^/(.+)/(info/refs|git-upload-pack|git-receive-pack)') 50 GIT_PROTO_PAT = re.compile(r'^/(.+)/(info/refs|git-upload-pack|git-receive-pack)')
155 if not perm: 155 if not perm:
156 return HTTPForbidden()(environ, start_response) 156 return HTTPForbidden()(environ, start_response)
157 157
158 # extras are injected into UI object and later available 158 # extras are injected into UI object and later available
159 # in hooks executed by rhodecode 159 # in hooks executed by rhodecode
160 from rhodecode import CONFIG 160 from kallithea import CONFIG
161 server_url = get_server_url(environ) 161 server_url = get_server_url(environ)
162 extras = { 162 extras = {
163 'ip': ip_addr, 163 'ip': ip_addr,
164 'username': username, 164 'username': username,
165 'action': action, 165 'action': action,
220 220
221 :param repo_name: name of the repository 221 :param repo_name: name of the repository
222 :param repo_path: full path to the repository 222 :param repo_path: full path to the repository
223 """ 223 """
224 224
225 from rhodecode.lib.middleware.pygrack import make_wsgi_app 225 from kallithea.lib.middleware.pygrack import make_wsgi_app
226 app = make_wsgi_app( 226 app = make_wsgi_app(
227 repo_root=safe_str(self.basepath), 227 repo_root=safe_str(self.basepath),
228 repo_name=repo_name, 228 repo_name=repo_name,
229 extras=extras, 229 extras=extras,
230 ) 230 )
273 273
274 def _handle_githooks(self, repo_name, action, baseui, environ): 274 def _handle_githooks(self, repo_name, action, baseui, environ):
275 """ 275 """
276 Handles pull action, push is handled by post-receive hook 276 Handles pull action, push is handled by post-receive hook
277 """ 277 """
278 from rhodecode.lib.hooks import log_pull_action 278 from kallithea.lib.hooks import log_pull_action
279 service = environ['QUERY_STRING'].split('=') 279 service = environ['QUERY_STRING'].split('=')
280 280
281 if len(service) < 2: 281 if len(service) < 2:
282 return 282 return
283 283
284 from rhodecode.model.db import Repository 284 from kallithea.model.db import Repository
285 _repo = Repository.get_by_repo_name(repo_name) 285 _repo = Repository.get_by_repo_name(repo_name)
286 _repo = _repo.scm_instance 286 _repo = _repo.scm_instance
287 287
288 _hooks = dict(baseui.configitems('hooks')) or {} 288 _hooks = dict(baseui.configitems('hooks')) or {}
289 if action == 'pull': 289 if action == 'pull':