changeset 2344:d680aee762a7

Fix notification about user creation - command needs a list of jids.
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Mon, 09 Jul 2007 01:09:40 +0200
parents 24242585fd70
children 59d83c1c6ffc
files MoinMoin/events/jabbernotify.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/events/jabbernotify.py	Mon Jul 09 00:29:38 2007 +0200
+++ b/MoinMoin/events/jabbernotify.py	Mon Jul 09 01:09:40 2007 +0200
@@ -23,6 +23,8 @@
 
 
 def handle(event):
+    """An event handler"""
+    
     cfg = event.request.cfg
 
     # Check for desired event type and if notification bot is configured
@@ -131,9 +133,10 @@
 def handle_user_created(event):
     """Handles an event sent when a new user is being created"""
 
+    jids = []
     user_ids = getUserList(event.request)
-    jids = []
     event_name = event.__class__.__name__
+    email = event.user.email or u"NOT SET"
     msg = u"""Dear Superuser, a new user has just been created. Details follow:
     User name: %s
     Email address: %s
@@ -147,9 +150,10 @@
             continue
 
         # Currently send this only to super users
-        # TODO: make it possible to disable this notification
         if usr.isSuperUser() and usr.jid and event_name in usr.subscribed_events:
-            send_notification(event.request, [usr.jid], msg % (event.user.name, email))
+            jids.append(usr.jid)
+    
+    send_notification(event.request, jids, msg % (event.user.name, email))
 
 
 def page_change(type, request, page, subscribers, **kwargs):