changeset 337:8cd545738d8e

Features: . [SF#467129] Lossage when username=e-mail-address . [SF#473123] Change message generation for author . MailGW now moves 'resolved' to 'chatting' on receiving e-mail for an issue.
author Richard Jones <richard@users.sourceforge.net>
date Tue, 30 Oct 2001 00:54:45 +0000
parents b3c103e536ed
children b24754a5c629
files CHANGES.txt MIGRATION.txt roundup/mailgw.py roundup/roundupdb.py roundup/templates/classic/dbinit.py roundup/templates/classic/detectors/nosyreaction.py roundup/templates/classic/instance_config.py roundup/templates/extended/dbinit.py roundup/templates/extended/detectors/nosyreaction.py roundup/templates/extended/instance_config.py
diffstat 10 files changed, 125 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Mon Oct 29 23:55:44 2001 +0000
+++ b/CHANGES.txt	Tue Oct 30 00:54:45 2001 +0000
@@ -2,6 +2,11 @@
 are given with the most recent entry first.
 
 2001-10-?? - 0.3.0 
+Feature:
+ . #467129 ] Lossage when username=e-mail-address
+ . #473123 ] Change message generation for author
+ . MailGW now moves 'resolved' to 'chatting' on receiving e-mail for an issue.
+
 Fixed:
  . Fixed a bug in HTMLTemplate changes.
  . 'unread' to 'chatting' automagic status change was b0rken.
--- a/MIGRATION.txt	Mon Oct 29 23:55:44 2001 +0000
+++ b/MIGRATION.txt	Tue Oct 30 00:54:45 2001 +0000
@@ -77,3 +77,7 @@
 the instance_config.py. Simplest solution is to copy the default values from
 template in the core source.
 
+MESSAGES_TO_AUTHOR has been added to the IssueClass in dbinit.py. Set to 'yes'
+to send nosy messages to the author. Default behaviour is to not send nosy
+messages to the author.
+
--- a/roundup/mailgw.py	Mon Oct 29 23:55:44 2001 +0000
+++ b/roundup/mailgw.py	Tue Oct 30 00:54:45 2001 +0000
@@ -72,7 +72,7 @@
 an exception, the original message is bounced back to the sender with the
 explanatory message given in the exception. 
 
-$Id: mailgw.py,v 1.25 2001-10-28 23:22:28 richard Exp $
+$Id: mailgw.py,v 1.26 2001-10-30 00:54:45 richard Exp $
 '''
 
 
@@ -365,17 +365,20 @@
             messages.append(message_id)
             props['messages'] = messages
 
-            # if the message is currently 'unread', then set it to 'chatting'
+            # if the message is currently 'unread' or 'resolved', then set
+            # it to 'chatting'
             if properties.has_key('status'):
                 try:
-                    # determine the id of 'unread' and 'chatting'
+                    # determine the id of 'unread', 'resolved' and 'chatting'
                     unread_id = self.db.status.lookup('unread')
+                    resolved_id = self.db.status.lookup('resolved')
                     chatting_id = self.db.status.lookup('chatting')
                 except KeyError:
                     pass
                 else:
                     if (not props.has_key('status') or
-                            props['status'] == unread_id):
+                            props['status'] == unread_id or
+                            props['status'] == resolved_id):
                         props['status'] = chatting_id
 
             cl.set(nodeid, **props)
@@ -441,6 +444,9 @@
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.25  2001/10/28 23:22:28  richard
+# fixed bug #474749 ] Indentations lost
+#
 # Revision 1.24  2001/10/23 22:57:52  richard
 # Fix unread->chatting auto transition, thanks Roch'e
 #
--- a/roundup/roundupdb.py	Mon Oct 29 23:55:44 2001 +0000
+++ b/roundup/roundupdb.py	Tue Oct 30 00:54:45 2001 +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.15 2001-10-23 01:00:18 richard Exp $
+# $Id: roundupdb.py,v 1.16 2001-10-30 00:54:45 richard Exp $
 
 import re, os, smtplib, socket
 
@@ -44,7 +44,23 @@
         '''
         (realname, address) = address
         users = self.user.stringFind(address=address)
-        if users: return users[0]
+        for dummy in range(2):
+            if len(users) > 1:
+                # make sure we don't match the anonymous or admin user
+                for user in users:
+                    if user == '1': continue
+                    if self.user.get(user, 'username') == 'anonymous': continue
+                    # first valid match will do
+                    return user
+                # well, I guess we have no choice
+                return user[0]
+            elif users:
+                return users[0]
+            # try to match the username to the address (for local
+            # submissions where the address is empty)
+            users = self.user.stringFind(username=address)
+
+        # couldn't match address or username, so create a new user
         return self.user.create(username=address, address=address,
             realname=realname)
 
@@ -200,6 +216,9 @@
 
 # XXX deviation from spec - was called ItemClass
 class IssueClass(Class):
+    # configuration
+    MESSAGES_TO_AUTHOR = 'no'
+
     # Overridden methods:
 
     def __init__(self, db, classname, **properties):
@@ -247,13 +266,25 @@
         r = {}
         for recipid in recipients:
             r[recipid] = 1
+
+        # figure the author's id, and indicate they've received the message
         authid = self.db.msg.get(msgid, 'author')
         r[authid] = 1
 
+        sendto = []
+        # ... but duplicate the message to the author as long as it's not
+        # the anonymous user
+        if (self.MESSAGES_TO_AUTHOR == 'yes' and
+                self.db.user.get(authid, 'username') != 'anonymous'):
+            sendto.append(authid)
+
         # now figure the nosy people who weren't recipients
-        sendto = []
         nosy = self.get(nodeid, 'nosy')
         for nosyid in nosy:
+            # Don't send nosy mail to the anonymous user (that user
+            # shouldn't appear in the nosy list, but just in case they
+            # do...)
+            if self.db.user.get(nosyid, 'username') == 'anonymous': continue
             if not r.has_key(nosyid):
                 sendto.append(nosyid)
                 recipients.append(nosyid)
@@ -278,6 +309,7 @@
             # TODO attachments
             m = ['Subject: [%s%s] %s'%(cn, nodeid, title)]
             m.append('To: %s'%', '.join(sendto))
+            m.append('From: %s'%self.ISSUE_TRACKER_EMAIL)
             m.append('Reply-To: %s'%self.ISSUE_TRACKER_EMAIL)
             m.append('')
             # add author information
@@ -307,6 +339,13 @@
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.15  2001/10/23 01:00:18  richard
+# Re-enabled login and registration access after lopping them off via
+# disabling access for anonymous users.
+# Major re-org of the htmltemplate code, cleaning it up significantly. Fixed
+# a couple of bugs while I was there. Probably introduced a couple, but
+# things seem to work OK at the moment.
+#
 # Revision 1.14  2001/10/21 07:26:35  richard
 # feature #473127: Filenames. I modified the file.index and htmltemplate
 #  source so that the filename is used in the link and the creation
--- a/roundup/templates/classic/dbinit.py	Mon Oct 29 23:55:44 2001 +0000
+++ b/roundup/templates/classic/dbinit.py	Tue Oct 30 00:54:45 2001 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: dbinit.py,v 1.8 2001-10-09 07:25:59 richard Exp $
+# $Id: dbinit.py,v 1.9 2001-10-30 00:54:45 richard Exp $
 
 import os
 
@@ -39,6 +39,7 @@
     ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL
     ADMIN_EMAIL = instance_config.ADMIN_EMAIL
     MAILHOST = instance_config.MAILHOST
+    MESSAGES_TO_AUTHOR = instance_config.MESSAGES_TO_AUTHOR
 
  
 def open(name=None):
@@ -125,6 +126,10 @@
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.8  2001/10/09 07:25:59  richard
+# Added the Password property type. See "pydoc roundup.password" for
+# implementation details. Have updated some of the documentation too.
+#
 # Revision 1.7  2001/08/07 00:24:43  richard
 # stupid typo
 #
--- a/roundup/templates/classic/detectors/nosyreaction.py	Mon Oct 29 23:55:44 2001 +0000
+++ b/roundup/templates/classic/detectors/nosyreaction.py	Tue Oct 30 00:54:45 2001 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-#$Id: nosyreaction.py,v 1.3 2001-08-07 00:24:43 richard Exp $
+#$Id: nosyreaction.py,v 1.4 2001-10-30 00:54:45 richard Exp $
 
 def nosyreaction(db, cl, nodeid, oldvalues):
     ''' A standard detector is provided that watches for additions to the
@@ -58,16 +58,20 @@
     n = {}
     for nosyid in nosy: n[nosyid] = 1
     change = 0
-    # but don't add admin to the nosy list
+    # but don't add admin or the anonymous user to the nosy list
     for msgid in messages:
         for recipid in db.msg.get(msgid, 'recipients'):
-            if recipid != '1' and not n.has_key(recipid):
-                change = 1
-                nosy.append(recipid)
+            if recipid == '1': continue
+            if n.has_key(recipid): continue
+            if db.user.get(recipid, 'username') == 'anonymous': continue
+            change = 1
+            nosy.append(recipid)
         authid = db.msg.get(msgid, 'author')
-        if authid != '1' and not n.has_key(authid):
-            change = 1
-            nosy.append(authid)
+        if authid == '1': continue
+        if n.has_key(authid): continue
+        if db.user.get(authid, 'username') == 'anonymous': continue
+        change = 1
+        nosy.append(authid)
     if change:
         cl.set(nodeid, nosy=nosy)
 
@@ -78,6 +82,9 @@
 
 #
 #$Log: not supported by cvs2svn $
+#Revision 1.3  2001/08/07 00:24:43  richard
+#stupid typo
+#
 #Revision 1.2  2001/08/07 00:15:51  richard
 #Added the copyright/license notice to (nearly) all files at request of
 #Bizar Software.
--- a/roundup/templates/classic/instance_config.py	Mon Oct 29 23:55:44 2001 +0000
+++ b/roundup/templates/classic/instance_config.py	Tue Oct 30 00:54:45 2001 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: instance_config.py,v 1.8 2001-10-23 01:00:18 richard Exp $
+# $Id: instance_config.py,v 1.9 2001-10-30 00:54:45 richard Exp $
 
 MAIL_DOMAIN=MAILHOST=HTTP_HOST=None
 HTTP_PORT=0
@@ -71,8 +71,18 @@
 # Deny or allow anonymous users to register through the web interface
 ANONYMOUS_REGISTER = 'deny'     # either 'deny' or 'allow'
 
+# Send nosy messages to the author of the message
+MESSAGES_TO_AUTHOR = 'no'       # either 'yes' or 'no'
+
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.8  2001/10/23 01:00:18  richard
+# Re-enabled login and registration access after lopping them off via
+# disabling access for anonymous users.
+# Major re-org of the htmltemplate code, cleaning it up significantly. Fixed
+# a couple of bugs while I was there. Probably introduced a couple, but
+# things seem to work OK at the moment.
+#
 # Revision 1.7  2001/10/22 03:25:01  richard
 # Added configuration for:
 #  . anonymous user access and registration (deny/allow)
--- a/roundup/templates/extended/dbinit.py	Mon Oct 29 23:55:44 2001 +0000
+++ b/roundup/templates/extended/dbinit.py	Tue Oct 30 00:54:45 2001 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: dbinit.py,v 1.12 2001-10-09 07:25:59 richard Exp $
+# $Id: dbinit.py,v 1.13 2001-10-30 00:54:45 richard Exp $
 
 import os
 
@@ -39,6 +39,7 @@
     ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL
     ADMIN_EMAIL = instance_config.ADMIN_EMAIL
     MAILHOST = instance_config.MAILHOST
+    MESSAGES_TO_AUTHOR = instance_config.MESSAGES_TO_AUTHOR
 
  
 def open(name=None):
@@ -175,6 +176,10 @@
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.12  2001/10/09 07:25:59  richard
+# Added the Password property type. See "pydoc roundup.password" for
+# implementation details. Have updated some of the documentation too.
+#
 # Revision 1.11  2001/08/07 00:24:43  richard
 # stupid typo
 #
--- a/roundup/templates/extended/detectors/nosyreaction.py	Mon Oct 29 23:55:44 2001 +0000
+++ b/roundup/templates/extended/detectors/nosyreaction.py	Tue Oct 30 00:54:45 2001 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-#$Id: nosyreaction.py,v 1.3 2001-08-07 00:24:43 richard Exp $
+#$Id: nosyreaction.py,v 1.4 2001-10-30 00:54:45 richard Exp $
 
 def nosyreaction(db, cl, nodeid, oldvalues):
     ''' A standard detector is provided that watches for additions to the
@@ -58,16 +58,20 @@
     n = {}
     for nosyid in nosy: n[nosyid] = 1
     change = 0
-    # but don't add admin to the nosy list
+    # but don't add admin or the anonymous user to the nosy list
     for msgid in messages:
         for recipid in db.msg.get(msgid, 'recipients'):
-            if recipid != '1' and not n.has_key(recipid):
-                change = 1
-                nosy.append(recipid)
+            if recipid == '1': continue
+            if n.has_key(recipid): continue
+            if db.user.get(recipid, 'username') == 'anonymous': continue
+            change = 1
+            nosy.append(recipid)
         authid = db.msg.get(msgid, 'author')
-        if authid != '1' and not n.has_key(authid):
-            change = 1
-            nosy.append(authid)
+        if authid == '1': continue
+        if n.has_key(authid): continue
+        if db.user.get(authid, 'username') == 'anonymous': continue
+        change = 1
+        nosy.append(authid)
     if change:
         cl.set(nodeid, nosy=nosy)
 
@@ -78,6 +82,9 @@
 
 #
 #$Log: not supported by cvs2svn $
+#Revision 1.3  2001/08/07 00:24:43  richard
+#stupid typo
+#
 #Revision 1.2  2001/08/07 00:15:51  richard
 #Added the copyright/license notice to (nearly) all files at request of
 #Bizar Software.
--- a/roundup/templates/extended/instance_config.py	Mon Oct 29 23:55:44 2001 +0000
+++ b/roundup/templates/extended/instance_config.py	Tue Oct 30 00:54:45 2001 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: instance_config.py,v 1.8 2001-10-23 01:00:18 richard Exp $
+# $Id: instance_config.py,v 1.9 2001-10-30 00:54:45 richard Exp $
 
 MAIL_DOMAIN=MAILHOST=HTTP_HOST=None
 HTTP_PORT=0
@@ -71,8 +71,18 @@
 # Deny or allow anonymous users to register through the web interface
 ANONYMOUS_REGISTER = 'deny'
 
+# Send nosy messages to the author of the message
+MESSAGES_TO_AUTHOR = 'no'       # either 'yes' or 'no'
+
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.8  2001/10/23 01:00:18  richard
+# Re-enabled login and registration access after lopping them off via
+# disabling access for anonymous users.
+# Major re-org of the htmltemplate code, cleaning it up significantly. Fixed
+# a couple of bugs while I was there. Probably introduced a couple, but
+# things seem to work OK at the moment.
+#
 # Revision 1.7  2001/10/22 03:25:01  richard
 # Added configuration for:
 #  . anonymous user access and registration (deny/allow)

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