comparison rhodecode/lib/middleware/simplegit.py @ 2969:5085e51fba3a beta

Implemented #628: Pass server URL to rc-extensions hooks - updated rc-ext docs
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 27 Oct 2012 15:36:53 +0200
parents ccbdff90e5a0
children a5f0bc867edc 9b92cf5a0cca
comparison
equal deleted inserted replaced
2968:4abfb1afd9f5 2969:5085e51fba3a
77 77
78 from paste.httpheaders import REMOTE_USER, AUTH_TYPE 78 from paste.httpheaders import REMOTE_USER, AUTH_TYPE
79 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError, \ 79 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError, \
80 HTTPBadRequest, HTTPNotAcceptable 80 HTTPBadRequest, HTTPNotAcceptable
81 81
82 from rhodecode.lib.utils2 import safe_str, fix_PATH 82 from rhodecode.lib.utils2 import safe_str, fix_PATH, get_server_url
83 from rhodecode.lib.base import BaseVCSController 83 from rhodecode.lib.base import BaseVCSController
84 from rhodecode.lib.auth import get_container_username 84 from rhodecode.lib.auth import get_container_username
85 from rhodecode.lib.utils import is_valid_repo, make_ui 85 from rhodecode.lib.utils import is_valid_repo, make_ui
86 from rhodecode.lib.compat import json 86 from rhodecode.lib.compat import json
87 from rhodecode.model.db import User, RhodeCodeUi 87 from rhodecode.model.db import User, RhodeCodeUi
187 return HTTPForbidden()(environ, start_response) 187 return HTTPForbidden()(environ, start_response)
188 188
189 # extras are injected into UI object and later available 189 # extras are injected into UI object and later available
190 # in hooks executed by rhodecode 190 # in hooks executed by rhodecode
191 from rhodecode import CONFIG 191 from rhodecode import CONFIG
192 server_url = get_server_url(environ)
192 extras = { 193 extras = {
193 'ip': ipaddr, 194 'ip': ipaddr,
194 'username': username, 195 'username': username,
195 'action': action, 196 'action': action,
196 'repository': repo_name, 197 'repository': repo_name,
197 'scm': 'git', 198 'scm': 'git',
198 'config': CONFIG['__file__'], 199 'config': CONFIG['__file__'],
200 'server_url': server_url,
199 'make_lock': None, 201 'make_lock': None,
200 'locked_by': [None, None] 202 'locked_by': [None, None]
201 } 203 }
202 204
203 #=================================================================== 205 #===================================================================