1515# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717#
18- # $Id: roundupdb.py,v 1.15 2001-10-23 01: 00:18 richard Exp $
18+ # $Id: roundupdb.py,v 1.16 2001-10-30 00:54:45 richard Exp $
1919
2020import re , os , smtplib , socket
2121
@@ -44,7 +44,23 @@ def uidFromAddress(self, address, create=1):
4444 '''
4545 (realname , address ) = address
4646 users = self .user .stringFind (address = address )
47- if users : return users [0 ]
47+ for dummy in range (2 ):
48+ if len (users ) > 1 :
49+ # make sure we don't match the anonymous or admin user
50+ for user in users :
51+ if user == '1' : continue
52+ if self .user .get (user , 'username' ) == 'anonymous' : continue
53+ # first valid match will do
54+ return user
55+ # well, I guess we have no choice
56+ return user [0 ]
57+ elif users :
58+ return users [0 ]
59+ # try to match the username to the address (for local
60+ # submissions where the address is empty)
61+ users = self .user .stringFind (username = address )
62+
63+ # couldn't match address or username, so create a new user
4864 return self .user .create (username = address , address = address ,
4965 realname = realname )
5066
@@ -200,6 +216,9 @@ def getprops(self, protected=1):
200216
201217# XXX deviation from spec - was called ItemClass
202218class IssueClass (Class ):
219+ # configuration
220+ MESSAGES_TO_AUTHOR = 'no'
221+
203222 # Overridden methods:
204223
205224 def __init__ (self , db , classname , ** properties ):
@@ -247,13 +266,25 @@ def sendmessage(self, nodeid, msgid):
247266 r = {}
248267 for recipid in recipients :
249268 r [recipid ] = 1
269+
270+ # figure the author's id, and indicate they've received the message
250271 authid = self .db .msg .get (msgid , 'author' )
251272 r [authid ] = 1
252273
253- # now figure the nosy people who weren't recipients
254274 sendto = []
275+ # ... but duplicate the message to the author as long as it's not
276+ # the anonymous user
277+ if (self .MESSAGES_TO_AUTHOR == 'yes' and
278+ self .db .user .get (authid , 'username' ) != 'anonymous' ):
279+ sendto .append (authid )
280+
281+ # now figure the nosy people who weren't recipients
255282 nosy = self .get (nodeid , 'nosy' )
256283 for nosyid in nosy :
284+ # Don't send nosy mail to the anonymous user (that user
285+ # shouldn't appear in the nosy list, but just in case they
286+ # do...)
287+ if self .db .user .get (nosyid , 'username' ) == 'anonymous' : continue
257288 if not r .has_key (nosyid ):
258289 sendto .append (nosyid )
259290 recipients .append (nosyid )
@@ -278,6 +309,7 @@ def sendmessage(self, nodeid, msgid):
278309 # TODO attachments
279310 m = ['Subject: [%s%s] %s' % (cn , nodeid , title )]
280311 m .append ('To: %s' % ', ' .join (sendto ))
312+ m .append ('From: %s' % self .ISSUE_TRACKER_EMAIL )
281313 m .append ('Reply-To: %s' % self .ISSUE_TRACKER_EMAIL )
282314 m .append ('' )
283315 # add author information
@@ -307,6 +339,13 @@ def email_footer(self, nodeid, msgid):
307339
308340#
309341# $Log: not supported by cvs2svn $
342+ # Revision 1.15 2001/10/23 01:00:18 richard
343+ # Re-enabled login and registration access after lopping them off via
344+ # disabling access for anonymous users.
345+ # Major re-org of the htmltemplate code, cleaning it up significantly. Fixed
346+ # a couple of bugs while I was there. Probably introduced a couple, but
347+ # things seem to work OK at the moment.
348+ #
310349# Revision 1.14 2001/10/21 07:26:35 richard
311350# feature #473127: Filenames. I modified the file.index and htmltemplate
312351# source so that the filename is used in the link and the creation
0 commit comments