Mercurial > kallithea
changeset 7725:a93b8a544f83
hooks: drop 'server_url' parameter
The parameter might be conceptually nice, but it was only available for 2
hooks. To be really useful, it should have been available everywhere. It also
only reported the URL from the web request that initiated the hook ... and as
such it does some layering violations. The user URL might be the address that
should be used internally from the hook. And it can conceptually not be made
available actions that doesn't originate from a user web request. It seems much
better that custom hooks configure what they want to do. Perhaps by reading the
.ini file and using canonical_url.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 10 Jan 2019 03:35:01 +0100 |
parents | b88150a90804 |
children | 16df4993b442 |
files | kallithea/config/rcextensions/__init__.py kallithea/lib/base.py kallithea/lib/utils2.py kallithea/model/scm.py |
diffstat | 4 files changed, 2 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/config/rcextensions/__init__.py Thu Jan 10 03:34:45 2019 +0100 +++ b/kallithea/config/rcextensions/__init__.py Thu Jan 10 03:35:01 2019 +0100 @@ -187,7 +187,6 @@ Post push hook kwargs available: - :param server_url: url of instance that triggered this hook :param config: path to .ini config used :param scm: type of VS 'git' or 'hg' :param username: name of user who pushed @@ -213,7 +212,6 @@ Post pull hook kwargs available:: - :param server_url: url of instance that triggered this hook :param config: path to .ini config used :param scm: type of VS 'git' or 'hg' :param username: name of user who pulled
--- a/kallithea/lib/base.py Thu Jan 10 03:34:45 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, get_server_url, _set_extras + safe_str, safe_int, _set_extras from kallithea.lib import auth_modules from kallithea.lib.auth import AuthUser, HasPermissionAnyMiddleware from kallithea.lib.compat import json @@ -340,7 +340,6 @@ 'repository': parsed_request.repo_name, 'scm': self.scm_alias, 'config': CONFIG['__file__'], - 'server_url': get_server_url(environ), } #======================================================================
--- a/kallithea/lib/utils2.py Thu Jan 10 03:34:45 2019 +0100 +++ b/kallithea/lib/utils2.py Thu Jan 10 03:35:01 2019 +0100 @@ -518,11 +518,6 @@ return str(_url) -def get_server_url(environ): - req = webob.Request(environ) - return req.host_url + req.script_name - - def _extract_extras(): """ Extracts the Kallithea extras data from os.environ, and wraps it into named
--- a/kallithea/model/scm.py Thu Jan 10 03:34:45 2019 +0100 +++ b/kallithea/model/scm.py Thu Jan 10 03:35:01 2019 +0100 @@ -47,8 +47,7 @@ from kallithea import BACKENDS from kallithea.lib import helpers as h -from kallithea.lib.utils2 import safe_str, safe_unicode, get_server_url, \ - _set_extras +from kallithea.lib.utils2 import safe_str, safe_unicode, _set_extras from kallithea.lib.auth import HasRepoPermissionLevel, HasRepoGroupPermissionLevel, \ HasUserGroupPermissionLevel, HasPermissionAny, HasPermissionAny from kallithea.lib.utils import get_filesystem_repos, make_ui, \ @@ -347,7 +346,6 @@ 'repository': repo_name, 'scm': repo_alias, 'config': CONFIG['__file__'], - 'server_url': get_server_url(environ), } _set_extras(extras)