# HG changeset patch # User Martin Bornhold # Date 2016-07-28 09:28:42 # Node ID 5fe4b2af6aff630fd24c0048725a201f5413ee6f # Parent 58b83ce1b361c14b645f8ed538046418e469e209 events: Trigger repository group events (create/update/delete) diff --git a/rhodecode/model/repo_group.py b/rhodecode/model/repo_group.py --- a/rhodecode/model/repo_group.py +++ b/rhodecode/model/repo_group.py @@ -33,6 +33,7 @@ import traceback from zope.cachedescriptors.property import Lazy as LazyProperty +from rhodecode import events from rhodecode.model import BaseModel from rhodecode.model.db import ( RepoGroup, UserRepoGroupToPerm, User, Permission, UserGroupRepoGroupToPerm, @@ -257,6 +258,9 @@ class RepoGroupModel(BaseModel): log_create_repository_group( created_by=user.username, **repo_group.get_dict()) + # Trigger create event. + events.trigger(events.RepoGroupCreateEvent(repo_group)) + return new_repo_group except Exception: self.sa.rollback() @@ -455,6 +459,9 @@ class RepoGroupModel(BaseModel): self._rename_group(old_path, new_path) + # Trigger update event. + events.trigger(events.RepoGroupUpdateEvent(repo_group)) + return repo_group except Exception: log.error(traceback.format_exc()) @@ -469,6 +476,9 @@ class RepoGroupModel(BaseModel): else: log.debug('skipping removal from filesystem') + # Trigger delete event. + events.trigger(events.RepoGroupDeleteEvent(repo_group)) + except Exception: log.error('Error removing repo_group %s', repo_group) raise