[Python-checkins] r54384 - in tracker: instances/python-dev/detectors/busybody.py roundup-src/roundup/roundupdb.py

erik.forsberg python-checkins at python.org
Wed Mar 14 20:31:38 CET 2007


Author: erik.forsberg
Date: Wed Mar 14 20:31:32 2007
New Revision: 54384

Modified:
   tracker/instances/python-dev/detectors/busybody.py
   tracker/roundup-src/roundup/roundupdb.py
Log:

Extensions to roundup to allow author of property-only changes to be
seen.

Use of these extensions in busybody.py.

Should fix problem noted in msg322 of
http://psf.upfronthosting.co.za/roundup/meta/issue32.


Modified: tracker/instances/python-dev/detectors/busybody.py
==============================================================================
--- tracker/instances/python-dev/detectors/busybody.py	(original)
+++ tracker/instances/python-dev/detectors/busybody.py	Wed Mar 14 20:31:32 2007
@@ -42,8 +42,13 @@
         except roundupdb.MessageSendError, message:
             raise roundupdb.DetectorError, message
     if not msgIDS:
+        # Find author associated with the last journal entry
+        journal = db.getjournal(cl.classname, nodeid)
+        authid = None
+        if [] != journal:
+            authid = journal[-1][2]
         try:
-            cl.send_message(nodeid, None, note, sendto)
+            cl.send_message(nodeid, None, note, sendto, authid=authid)
         except roundupdb.MessageSendError, message:
             raise roundupdb.DetectorError, message
 

Modified: tracker/roundup-src/roundup/roundupdb.py
==============================================================================
--- tracker/roundup-src/roundup/roundupdb.py	(original)
+++ tracker/roundup-src/roundup/roundupdb.py	Wed Mar 14 20:31:32 2007
@@ -250,7 +250,7 @@
     sendmessage = nosymessage
 
     def send_message(self, nodeid, msgid, note, sendto, from_address=None,
-            bcc_sendto=[]):
+            bcc_sendto=[], authid=None):
         '''Actually send the nominated message from this node to the sendto
            recipients, with the note appended.
         '''
@@ -280,7 +280,12 @@
         title = self.get(nodeid, 'title') or '%s message copy'%cn
 
         # figure author information
-        if msgid:
+        if authid:
+            authname = users.get(authid, 'realname')
+            if not authname:
+                authname = users.get(authid, 'username', '')
+            authaddr = users.get(authid, 'address', '')            
+        elif msgid:
             authid = messages.get(msgid, 'author')
             authname = users.get(authid, 'realname')
             if not authname:
@@ -304,12 +309,15 @@
 
         # add author information
         if authid:
-            if len(self.get(nodeid,'messages')) == 1:
+            if msgid and len(self.get(nodeid,'messages')) == 1:
                 m.append(_("New submission from %(authname)s:")
                     % locals())
-            else:
+            elif msgid:
                 m.append(_("%(authname)s added the comment:")
                     % locals())
+            else:
+                m.append(_("Changes by %(authname)s:")
+                         % locals())
         else:
             m.append(_("System message:"))
         m.append('')


More information about the Python-checkins mailing list