Changeset - 2589ee18c796
[Not reviewed]
default
0 1 0
Thomas De Schampheleire - 5 years ago 2020-09-30 16:57:05
thomas.de_schampheleire@nokia.com
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.
1 file changed with 7 insertions and 27 deletions:
0 comments (0 inline, 0 general)
kallithea/config/rcextensions/__init__.py
Show inline comments
 
@@ -27,13 +27,13 @@ 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:
 
     :param repo_name:
 
     :param repo_type:
 
     :param description:
 
@@ -47,20 +47,17 @@ def _crrepohook(*args, **kwargs):
 
     :param fork_id:
 
     :param group_id:
 
     :param created_by:
 
    """
 

	
 

	
 
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
 
    will be displayed to the user.
 
    kwargs available:
 
    :param username:
 
@@ -73,19 +70,17 @@ def _pre_cruserhook(*args, **kwargs):
 
    :param created_by:
 
    """
 
    reason = 'allowed'
 
    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:
 
      :param username:
 
      :param full_name_or_username:
 
      :param full_contact:
 
@@ -105,20 +100,17 @@ def _cruserhook(*args, **kwargs):
 
      :param password:
 
      :param emails:
 
      :param created_by:
 
    """
 

	
 

	
 
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:
 
     :param repo_name:
 
     :param repo_type:
 
     :param description:
 
@@ -133,20 +125,17 @@ def _dlrepohook(*args, **kwargs):
 
     :param group_id:
 
     :param deleted_by:
 
     :param deleted_on:
 
    """
 

	
 

	
 
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:
 
      :param username:
 
      :param full_name_or_username:
 
      :param full_contact:
 
@@ -166,22 +155,19 @@ def _dluserhook(*args, **kwargs):
 
      :param password:
 
      :param emails:
 
      :param deleted_by:
 
    """
 

	
 

	
 
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:
 

	
 
      :param config: path to .ini config used
 
      :param scm: type of VS 'git' or 'hg'
 
@@ -190,30 +176,24 @@ def _pushhook(*args, **kwargs):
 
      :param action: push
 
      :param repository: repository name
 
      :param pushed_revs: list of pushed revisions
 
    """
 

	
 

	
 
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::
 

	
 
      :param config: path to .ini config used
 
      :param scm: type of VS 'git' or 'hg'
 
      :param username: name of user who pulled
 
      :param ip: ip of who pulled
 
      :param action: pull
 
      :param repository: repository name
 
    """
 

	
 

	
 
PULL_HOOK = _pullhook
0 comments (0 inline, 0 general)