You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2014/02/24 16:17:00 UTC

[5/5] git commit: [#7014] ticket:524 Added create/update/delete events for TroveCollection model

[#7014] ticket:524 Added create/update/delete events for TroveCollection model


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/e0d5dd62
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/e0d5dd62
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/e0d5dd62

Branch: refs/heads/master
Commit: e0d5dd623b53de5fa06b01e1ead3f397357e47f1
Parents: 5bc9daf
Author: Ferens Dmitriy <fe...@gmail.com>
Authored: Tue Jan 28 16:11:10 2014 +0200
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Mon Feb 24 15:15:41 2014 +0000

----------------------------------------------------------------------
 Allura/allura/model/project.py | 13 +++++++++++++
 Allura/docs/extending.rst      |  3 +++
 2 files changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e0d5dd62/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index 452652c..e5902b8 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -89,11 +89,24 @@ class ProjectCategory(MappedClass):
         return self.query.find(dict(parent_id=self._id)).all()
 
 
+class TroveCategoryMapperExtension(MapperExtension):
+
+    def after_insert(self, obj, state, sess):
+        g.post_event('trove_category_created', obj._id)
+
+    def after_update(self, obj, state, sess):
+        g.post_event('trove_category_updated', obj._id)
+
+    def after_delete(self, obj, state, sess):
+        g.post_event('trove_category_deleted', obj._id)
+
+
 class TroveCategory(MappedClass):
 
     class __mongometa__:
         session = main_orm_session
         name = 'trove_category'
+        extensions = [TroveCategoryMapperExtension]
         indexes = ['trove_cat_id', 'trove_parent_id', 'shortname', 'fullpath']
 
     _id = FieldProperty(S.ObjectId)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e0d5dd62/Allura/docs/extending.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/extending.rst b/Allura/docs/extending.rst
index 1e7cef7..5a0170f 100644
--- a/Allura/docs/extending.rst
+++ b/Allura/docs/extending.rst
@@ -66,6 +66,9 @@ The events that allura publishes are:
 * repo_cloned
 * repo_refreshed
 * repo_clone_task_failed
+* trove_category_created
+* trove_category_updated
+* trove_category_deleted
 
 
 Markdown Macros