changeset 2065:23d90aae61b5

Send events when an user subscribes to a page and when page gets reverted.
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Thu, 31 May 2007 01:01:35 +0200
parents 5cc8f6714297
children b73b2b885b02
files MoinMoin/action/revert.py MoinMoin/user.py
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/revert.py	Thu May 31 01:00:27 2007 +0200
+++ b/MoinMoin/action/revert.py	Thu May 31 01:01:35 2007 +0200
@@ -40,5 +40,10 @@
         from MoinMoin import caching
         caching.CacheEntry(request, pg, key, scope='item').remove()
         caching.CacheEntry(request, pg, "pagelinks", scope='item').remove()
+        
+        # Notify observers
+        from MoinMoin.events import PageRevertedEvent, send_event
+        e = PageRevertedEvent(request, pagename, request.rev, revstr)
+        send_event(e)
 
     pg.send_page(msg=msg)
--- a/MoinMoin/user.py	Thu May 31 01:00:27 2007 +0200
+++ b/MoinMoin/user.py	Thu May 31 01:01:35 2007 +0200
@@ -733,6 +733,11 @@
         if pagename not in self.subscribed_pages:
             self.subscribed_pages.append(pagename)
             self.save()
+            
+            # Send a notification
+            from MoinMoin.events import SubscribedToPageEvent, send_event
+            e = SubscribedToPageEvent(self._request, pagename, self.name)
+            send_event(e)
             return True
 
         return False