changeset 2948:361c8b582018

Fix errors with user creation notification as reported by cb22
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Thu, 29 Nov 2007 17:39:44 +0100
parents a7ed0a410ced
children 2def79ea092e
files MoinMoin/events/jabbernotify.py
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/events/jabbernotify.py	Thu Nov 29 17:39:12 2007 +0100
+++ b/MoinMoin/events/jabbernotify.py	Thu Nov 29 17:39:44 2007 +0100
@@ -145,7 +145,7 @@
     sitename = event.request.cfg.sitename
     username = event.user.name
 
-    data = notification.user_created_message(event.request, sitename, username, email)
+    msg = notification.user_created_message(event.request, sitename, username, email)
 
     for id in user_ids:
         usr = User(event.request, id=id)
@@ -154,7 +154,10 @@
         if usr.isSuperUser() and usr.jid and event_name in usr.jabber_subscribed_events:
             jids.append(usr.jid)
 
-    send_notification(event.request, jids, data['body'], data['subject'], "user_created")
+    data = {'action': "user_created", 'subject': msg['subject'], 'text': msg['body'],
+            'url_list': []}
+
+    send_notification(event.request, jids, data)
 
 
 def page_change(change_type, request, page, subscribers, **kwargs):
@@ -198,12 +201,12 @@
     _ = request.getText
     server = request.cfg.notification_server
 
+    if type(notification) != dict:
+        raise ValueError("notification must be of type dict!")
+
     if type(notification['url_list']) != list:
         raise ValueError("url_list must be of type list!")
 
-    if type(notification) != dict:
-        raise ValueError("notification must be of type dict!")
-
     try:
         server.send_notification(request.cfg.secret, jids, notification)
         return True