Mercurial > kallithea
changeset 7727:1901954df11d
middleware: use shared code for setting hook context (KALLITHEA_EXTRAS environment variable)
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 10 Jan 2019 03:35:01 +0100 |
parents | 16df4993b442 |
children | 7ba73396e5ba |
files | kallithea/lib/base.py |
diffstat | 1 files changed, 3 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/base.py Thu Jan 10 23:30:58 2019 +0100 +++ b/kallithea/lib/base.py Thu Jan 10 03:35:01 2019 +0100 @@ -49,7 +49,7 @@ from kallithea.config.routing import url from kallithea.lib.utils2 import str2bool, safe_unicode, AttributeDict, \ - safe_str, safe_int, _set_extras + safe_str, safe_int from kallithea.lib import auth_modules from kallithea.lib.auth import AuthUser, HasPermissionAnyMiddleware from kallithea.lib.compat import json @@ -330,23 +330,11 @@ if response_app is not None: return response_app(environ, start_response) - # extras are injected into Mercurial UI object and later available - # in hooks executed by Kallithea - from kallithea import CONFIG - extras = { - 'ip': ip_addr, - 'username': user.username, - 'action': parsed_request.action, - 'repository': parsed_request.repo_name, - 'scm': self.scm_alias, - 'config': CONFIG['__file__'], - } - #====================================================================== # REQUEST HANDLING #====================================================================== - log.debug('HOOKS extras is %s', extras) - _set_extras(extras) + ScmModel()._handle_rc_scm_extras(user.username, ip_addr, + parsed_request.repo_name, self.scm_alias, parsed_request.action) try: log.info('%s action on %s repo "%s" by "%s" from %s',