Code

removed debugging
[roundup.git] / roundup / roundupdb.py
index 8cbf92bee02dbfbf1815bf89ff9b5ae919be26c4..4ad3eb952cad36a928fdbeafe826141ce7ae8a7e 100644 (file)
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: roundupdb.py,v 1.64 2002-09-10 00:18:20 richard Exp $
+# $Id: roundupdb.py,v 1.68 2002-09-11 02:20:35 richard Exp $
 
 __doc__ = """
 Extending hyperdb with types specific to issue-tracking.
@@ -46,9 +46,11 @@ class MessageSendError(RuntimeError):
     pass
 
 class DetectorError(RuntimeError):
+    ''' Raised by detectors that want to indicate that something's amiss
+    '''
     pass
 
-# XXX deviation from spec - was called ItemClass
+# deviation from spec - was called IssueClass
 class IssueClass:
     """ This class is intended to be mixed-in with a hyperdb backend
         implementation. The backend should provide a mechanism that
@@ -134,7 +136,7 @@ class IssueClass:
             # send the message
             self.send_message(nodeid, msgid, note, sendto)
 
-    # XXX backwards compatibility - don't remove
+    # backwards compatibility - don't remove
     sendmessage = nosymessage
 
     def send_message(self, nodeid, msgid, note, sendto):
@@ -214,10 +216,10 @@ class IssueClass:
         writer.addheader('Subject', '[%s%s] %s'%(cn, nodeid, title))
         writer.addheader('To', ', '.join(sendto))
         writer.addheader('From', straddr(
-                              (authname, self.db.config.ISSUE_TRACKER_EMAIL) ) )
+                              (authname, self.db.config.TRACKER_EMAIL) ) )
         writer.addheader('Reply-To', straddr( 
-                                        (self.db.config.INSTANCE_NAME,
-                                         self.db.config.ISSUE_TRACKER_EMAIL) ) )
+                                        (self.db.config.TRACKER_NAME,
+                                         self.db.config.TRACKER_EMAIL) ) )
         writer.addheader('MIME-Version', '1.0')
         if messageid:
             writer.addheader('Message-Id', messageid)
@@ -225,7 +227,7 @@ class IssueClass:
             writer.addheader('In-Reply-To', inreplyto)
 
         # add a uniquely Roundup header to help filtering
-        writer.addheader('X-Roundup-Name', self.db.config.INSTANCE_NAME)
+        writer.addheader('X-Roundup-Name', self.db.config.TRACKER_NAME)
 
         # attach files
         if message_files:
@@ -285,20 +287,19 @@ class IssueClass:
     def email_signature(self, nodeid, msgid):
         ''' Add a signature to the e-mail with some useful information
         '''
-
         # simplistic check to see if the url is valid,
         # then append a trailing slash if it is missing
-        base = self.db.config.ISSUE_TRACKER_WEB 
+        base = self.db.config.TRACKER_WEB 
         if not isinstance(base , type('')) or not base.startswith('http://'):
-            base = "Configuration Error: ISSUE_TRACKER_WEB isn't a " \
+            base = "Configuration Error: TRACKER_WEB isn't a " \
                 "fully-qualified URL"
         elif base[-1] != '/' :
             base += '/'
-        web = base + 'issue'+ nodeid
+        web = base + self.classname + nodeid
 
         # ensure the email address is properly quoted
-        email = straddr((self.db.config.INSTANCE_NAME,
-            self.db.config.ISSUE_TRACKER_EMAIL))
+        email = straddr((self.db.config.TRACKER_NAME,
+            self.db.config.TRACKER_EMAIL))
 
         line = '_' * max(len(web), len(email))
         return '%s\n%s\n%s\n%s'%(line, email, web, line)
@@ -405,6 +406,7 @@ class IssueClass:
                     else:
                         l.append(entry)
                 if l:
+                    l.sort()
                     change = '+%s'%(', '.join(l))
                     l = []
                 # check for removals
@@ -415,6 +417,7 @@ class IssueClass:
                     else:
                         l.append(entry)
                 if l:
+                    l.sort()
                     change += ' -%s'%(', '.join(l))
             else:
                 change = '%s -> %s'%(oldvalue, value)