changeset 2331:493565b060ff

Raise exception if notifications are enabled but no secret is set.
author Karol Nowak <grzywacz@sul.uni.lodz.pl>
date Tue, 26 Jun 2007 16:39:06 +0200
parents 38f4f0311a98
children 456545b5acfe
files MoinMoin/config/multiconfig.py MoinMoin/events/jabbernotify.py
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/config/multiconfig.py	Tue Jun 26 15:25:15 2007 +0200
+++ b/MoinMoin/config/multiconfig.py	Tue Jun 26 16:39:06 2007 +0200
@@ -683,6 +683,14 @@
         
         # if we are to use the jabber bot, instantiate a server object for future use
         if self.jabber_enabled:
+            
+            errmsg = "You must set a (long) secret string to send notifications!"
+            try:
+                if not self.secret:
+                    raise error.ConfigurationError(errmsg)
+            except AttributeError, err:
+                    raise error.ConfigurationError(errmsg)
+            
             from xmlrpclib import Server
             self.notification_server = Server(self.notification_bot_uri, )
             
--- a/MoinMoin/events/jabbernotify.py	Tue Jun 26 15:25:15 2007 +0200
+++ b/MoinMoin/events/jabbernotify.py	Tue Jun 26 16:39:06 2007 +0200
@@ -28,10 +28,6 @@
     # Check for desired event type and if notification bot is configured
     if not cfg.jabber_enabled:
         return
-    
-    if not cfg.secret:
-        errmsg = "You must set a (long) secret string to send notifications!"
-        raise error.ConfigurationError(errmsg)
 
     if isinstance(event, ev.PageChangedEvent):
         return handle_page_changed(event)