##// END OF EJS Templates
events: Trigger repository group events (create/update/delete)
Martin Bornhold -
r557:5fe4b2af default
parent child Browse files
Show More
@@ -33,6 +33,7 b' import traceback'
33
33
34 from zope.cachedescriptors.property import Lazy as LazyProperty
34 from zope.cachedescriptors.property import Lazy as LazyProperty
35
35
36 from rhodecode import events
36 from rhodecode.model import BaseModel
37 from rhodecode.model import BaseModel
37 from rhodecode.model.db import (
38 from rhodecode.model.db import (
38 RepoGroup, UserRepoGroupToPerm, User, Permission, UserGroupRepoGroupToPerm,
39 RepoGroup, UserRepoGroupToPerm, User, Permission, UserGroupRepoGroupToPerm,
@@ -257,6 +258,9 b' class RepoGroupModel(BaseModel):'
257 log_create_repository_group(
258 log_create_repository_group(
258 created_by=user.username, **repo_group.get_dict())
259 created_by=user.username, **repo_group.get_dict())
259
260
261 # Trigger create event.
262 events.trigger(events.RepoGroupCreateEvent(repo_group))
263
260 return new_repo_group
264 return new_repo_group
261 except Exception:
265 except Exception:
262 self.sa.rollback()
266 self.sa.rollback()
@@ -455,6 +459,9 b' class RepoGroupModel(BaseModel):'
455
459
456 self._rename_group(old_path, new_path)
460 self._rename_group(old_path, new_path)
457
461
462 # Trigger update event.
463 events.trigger(events.RepoGroupUpdateEvent(repo_group))
464
458 return repo_group
465 return repo_group
459 except Exception:
466 except Exception:
460 log.error(traceback.format_exc())
467 log.error(traceback.format_exc())
@@ -469,6 +476,9 b' class RepoGroupModel(BaseModel):'
469 else:
476 else:
470 log.debug('skipping removal from filesystem')
477 log.debug('skipping removal from filesystem')
471
478
479 # Trigger delete event.
480 events.trigger(events.RepoGroupDeleteEvent(repo_group))
481
472 except Exception:
482 except Exception:
473 log.error('Error removing repo_group %s', repo_group)
483 log.error('Error removing repo_group %s', repo_group)
474 raise
484 raise
General Comments 0
You need to be logged in to leave comments. Login now