Skip to content

Commit 9a44f4b

Browse files
author
Derrick Hudson
committed
[SF#565992] if ISSUE_TRACKER_WEB doesn't have the trailing '/', add it
use the rfc822 module to ensure that every (oddball) email address and real-name is properly quoted
1 parent 8bd7149 commit 9a44f4b

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ Feature:
4040
- also changed cgi client since it was duplicating the functionality
4141

4242
Fixed:
43+
. #565992 ] if ISSUE_TRACKER_WEB doesn't have the trailing '/', add it
44+
. use the rfc822 module to ensure that every (oddball) email address and
45+
real-name is properly quoted
4346
. #558867 ] ZRoundup redirect /instance requests to /instance/
4447
. #562130 ] cookie path generated from ZRoundup was wrong in some situations
4548
. stop sending blank (whitespace-only) notes

roundup/roundupdb.py

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: roundupdb.py,v 1.55 2002-06-11 04:58:07 richard Exp $
18+
# $Id: roundupdb.py,v 1.56 2002-06-14 03:54:21 dman13 Exp $
1919

2020
__doc__ = """
2121
Extending hyperdb with types specific to issue-tracking.
@@ -24,6 +24,7 @@
2424
import re, os, smtplib, socket, copy, time, random
2525
import MimeWriter, cStringIO
2626
import base64, quopri, mimetypes
27+
import rfc822
2728

2829
import hyperdb, date
2930

@@ -394,7 +395,7 @@ def send_message(self, nodeid, msgid, note, sendto):
394395
authname = users.get(authid, 'username')
395396
authaddr = users.get(authid, 'address')
396397
if authaddr:
397-
authaddr = ' <%s>'%authaddr
398+
authaddr = rfc822.dump_address_pair( ('',authaddr) )
398399
else:
399400
authaddr = ''
400401

@@ -440,10 +441,11 @@ def send_message(self, nodeid, msgid, note, sendto):
440441
writer = MimeWriter.MimeWriter(message)
441442
writer.addheader('Subject', '[%s%s] %s'%(cn, nodeid, title))
442443
writer.addheader('To', ', '.join(sendto))
443-
writer.addheader('From', '%s <%s>'%(authname,
444-
self.db.config.ISSUE_TRACKER_EMAIL))
445-
writer.addheader('Reply-To', '%s <%s>'%(self.db.config.INSTANCE_NAME,
446-
self.db.config.ISSUE_TRACKER_EMAIL))
444+
writer.addheader('From', rfc822.dump_address_pair(
445+
(authname, self.db.config.ISSUE_TRACKER_EMAIL) ) )
446+
writer.addheader('Reply-To', rfc822.dump_address_pair(
447+
(self.db.config.INSTANCE_NAME,
448+
self.db.config.ISSUE_TRACKER_EMAIL) ) )
447449
writer.addheader('MIME-Version', '1.0')
448450
if messageid:
449451
writer.addheader('Message-Id', messageid)
@@ -511,12 +513,25 @@ def send_message(self, nodeid, msgid, note, sendto):
511513
def email_signature(self, nodeid, msgid):
512514
''' Add a signature to the e-mail with some useful information
513515
'''
514-
web = self.db.config.ISSUE_TRACKER_WEB + 'issue'+ nodeid
515-
email = '"%s" <%s>'%(self.db.config.INSTANCE_NAME,
516-
self.db.config.ISSUE_TRACKER_EMAIL)
516+
517+
# simplistic check to see if the url is valid,
518+
# then append a trailing slash if it is missing
519+
base = self.db.config.ISSUE_TRACKER_WEB
520+
if not isinstance( base , "" ) or not base.startswith( "http://" ) :
521+
base = "Configuration Error: ISSUE_TRACKER_WEB isn't a fully-qualified URL"
522+
elif base[-1] != '/' :
523+
base += '/'
524+
web = base + 'issue'+ nodeid
525+
#web = self.db.config.ISSUE_TRACKER_WEB + 'issue'+ nodeid
526+
527+
# ensure the email address is properly quoted
528+
email = rfc822.dump_address_pair( self.db.config.INSTANCE_NAME ,
529+
self.db.config.ISSUE_TRACKER_EMAIL )
530+
517531
line = '_' * max(len(web), len(email))
518532
return '%s\n%s\n%s\n%s'%(line, email, web, line)
519533

534+
520535
def generateCreateNote(self, nodeid):
521536
"""Generate a create note that lists initial property values
522537
"""
@@ -634,6 +649,9 @@ def generateChangeNote(self, nodeid, oldvalues):
634649

635650
#
636651
# $Log: not supported by cvs2svn $
652+
# Revision 1.55 2002/06/11 04:58:07 richard
653+
# detabbing
654+
#
637655
# Revision 1.54 2002/05/29 01:16:17 richard
638656
# Sorry about this huge checkin! It's fixing a lot of related stuff in one go
639657
# though.
@@ -815,7 +833,7 @@ def generateChangeNote(self, nodeid, oldvalues):
815833
# . Login now takes you to the page you back to the were denied access to.
816834
#
817835
# Fixed:
818-
# . Lots of bugs, thanks Roché and others on the devel mailing list!
836+
# . Lots of bugs, thanks Roché and others on the devel mailing list!
819837
#
820838
# Revision 1.20 2001/11/25 10:11:14 jhermann
821839
# Typo fix

0 commit comments

Comments
 (0)