# HG changeset patch # User Thomas De Schampheleire # Date 2020-09-30 16:57:05 # Node ID 2589ee18c7962517690d8c77e22a79bf9e77839d # Parent af7b367f6b5a2491d9fed37c79530e66e3e81878 rcextensions: rename default hook stubs There seems to be no reason that in indirection is needed between the actual hook name and the implementation. Moreover, the implementation names were unnecessary complex. diff --git a/kallithea/config/rcextensions/__init__.py b/kallithea/config/rcextensions/__init__.py --- a/kallithea/config/rcextensions/__init__.py +++ b/kallithea/config/rcextensions/__init__.py @@ -30,7 +30,7 @@ EXTRA_INDEX_EXTENSIONS = [] # POST CREATE REPOSITORY HOOK #============================================================================== # this function will be executed after each repository is created -def _crrepohook(*args, **kwargs): +def CREATE_REPO_HOOK(*args, **kwargs): """ Post create repository HOOK kwargs available: @@ -50,14 +50,11 @@ def _crrepohook(*args, **kwargs): """ -CREATE_REPO_HOOK = _crrepohook - - #============================================================================== # PRE CREATE USER HOOK #============================================================================== # this function will be executed before each user is created -def _pre_cruserhook(*args, **kwargs): +def PRE_CREATE_USER_HOOK(*args, **kwargs): """ Pre create user HOOK, it returns a tuple of bool, reason. If bool is False the user creation will be stopped and reason @@ -76,13 +73,11 @@ def _pre_cruserhook(*args, **kwargs): return True, reason -PRE_CREATE_USER_HOOK = _pre_cruserhook - #============================================================================== # POST CREATE USER HOOK #============================================================================== # this function will be executed after each user is created -def _cruserhook(*args, **kwargs): +def CREATE_USER_HOOK(*args, **kwargs): """ Post create user HOOK kwargs available: @@ -108,14 +103,11 @@ def _cruserhook(*args, **kwargs): """ -CREATE_USER_HOOK = _cruserhook - - #============================================================================== # POST DELETE REPOSITORY HOOK #============================================================================== # this function will be executed after each repository deletion -def _dlrepohook(*args, **kwargs): +def DELETE_REPO_HOOK(*args, **kwargs): """ Post delete repository HOOK kwargs available: @@ -136,14 +128,11 @@ def _dlrepohook(*args, **kwargs): """ -DELETE_REPO_HOOK = _dlrepohook - - #============================================================================== # POST DELETE USER HOOK #============================================================================== # this function will be executed after each user is deleted -def _dluserhook(*args, **kwargs): +def DELETE_USER_HOOK(*args, **kwargs): """ Post delete user HOOK kwargs available: @@ -169,16 +158,13 @@ def _dluserhook(*args, **kwargs): """ -DELETE_USER_HOOK = _dluserhook - - #============================================================================== # POST PUSH HOOK #============================================================================== # this function will be executed after each push it's executed after the # build-in hook that Kallithea uses for logging pushes -def _pushhook(*args, **kwargs): +def PUSH_HOOK(*args, **kwargs): """ Post push hook kwargs available: @@ -193,16 +179,13 @@ def _pushhook(*args, **kwargs): """ -PUSH_HOOK = _pushhook - - #============================================================================== # POST PULL HOOK #============================================================================== # this function will be executed after each push it's executed after the # build-in hook that Kallithea uses for logging pulls -def _pullhook(*args, **kwargs): +def PULL_HOOK(*args, **kwargs): """ Post pull hook kwargs available:: @@ -214,6 +197,3 @@ def _pullhook(*args, **kwargs): :param action: pull :param repository: repository name """ - - -PULL_HOOK = _pullhook