diff roundup/roundupdb.py @ 684:5b23ff865f3a

added a "detectors" directory... ...for people to put their useful auditors and reactors in. Note - the roundupdb.IssueClass.sendmessage method has been split and renamed "nosymessage" specifically for things like the nosy reactor, and "send_message" which just sends the message. The initial detector is one that we'll be using here at ekit - it bounces new issue messages to a team address.
author Richard Jones <richard@users.sourceforge.net>
date Mon, 08 Apr 2002 03:40:31 +0000
parents 52ca0ae46044
children de6dc74a4148
line wrap: on
line diff
--- a/roundup/roundupdb.py	Wed Apr 03 07:05:50 2002 +0000
+++ b/roundup/roundupdb.py	Mon Apr 08 03:40:31 2002 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: roundupdb.py,v 1.49 2002-03-19 06:41:49 richard Exp $
+# $Id: roundupdb.py,v 1.50 2002-04-08 03:40:31 richard Exp $
 
 __doc__ = """
 Extending hyperdb with types specific to issue-tracking.
@@ -297,7 +297,7 @@
         appended to the "messages" field of the specified issue.
         """
 
-    def sendmessage(self, nodeid, msgid, change_note):
+    def nosymessage(self, nodeid, msgid, change_note):
         """Send a message to the members of an issue's nosy list.
 
         The message is sent only to users on the nosy list who are not
@@ -307,7 +307,6 @@
         """
         users = self.db.user
         messages = self.db.msg
-        files = self.db.file
 
         # figure the recipient ids
         sendto = []
@@ -342,13 +341,30 @@
                 sendto.append(nosyid)
                 recipients.append(nosyid)
 
-        # no new recipients
-        if not sendto:
-            return
+        # we have new recipients
+        if sendto:
+            # update the message's recipients list
+            messages.set(msgid, recipients=recipients)
+
+            # send the message
+            self.send_message(nodeid, msgid, change_note, sendto)
+
+    # XXX backwards compatibility - don't remove
+    sendmessage = nosymessage
+
+    def send_message(self, nodeid, msgid, note, sendto):
+        '''Actually send the nominated message from this node to the sendto
+           recipients, with the note appended.
+        '''
+        users = self.db.user
+        messages = self.db.msg
+        files = self.db.file
 
         # determine the messageid and inreplyto of the message
         inreplyto = messages.get(msgid, 'inreplyto')
         messageid = messages.get(msgid, 'messageid')
+
+        # make up a messageid if there isn't one (web edit)
         if not messageid:
             # this is an old message that didn't get a messageid, so
             # create one
@@ -356,8 +372,8 @@
                 self.classname, nodeid, self.db.config.MAIL_DOMAIN)
             messages.set(msgid, messageid=messageid)
 
-        # update the message's recipients list
-        messages.set(msgid, recipients=recipients)
+        # figure the author's id
+        authid = messages.get(msgid, 'author')
 
         # send an email to the people who missed out
         sendto = [users.get(i, 'address') for i in sendto]
@@ -391,8 +407,8 @@
         m.append(messages.get(msgid, 'content'))
 
         # add the change note
-        if change_note:
-            m.append(change_note)
+        if note:
+            m.append(note)
 
         # put in roundup's signature
         if self.db.config.EMAIL_SIGNATURE_POSITION == 'bottom':
@@ -604,6 +620,9 @@
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.49  2002/03/19 06:41:49  richard
+# Faster, easier, less mess ;)
+#
 # Revision 1.48  2002/03/18 18:32:00  rochecompaan
 # All messages sent to the nosy list are now encoded as quoted-printable.
 #

Roundup Issue Tracker: http://roundup-tracker.org/