summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f1b0d4a)
raw | patch | inline | side by side (parent: f1b0d4a)
author | dman13 <dman13@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sat, 15 Jun 2002 15:49:29 +0000 (15:49 +0000) | ||
committer | dman13 <dman13@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sat, 15 Jun 2002 15:49:29 +0000 (15:49 +0000) |
Don't use isinstance() on a string (not allowed in python 2.1).
Return an error message instead of crashing if 'oldvalues' isn't a
dict (in generateChangeNote).
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@783 57a73879-2fb5-44c3-a270-3262357dd7e2
Return an error message instead of crashing if 'oldvalues' isn't a
dict (in generateChangeNote).
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@783 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/roundupdb.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index ee69de26f944b2f39b1c488ad3462f38b9bf206d..eace6d22e825c4dc73f3dd6796d3fcd853168a82 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
- also changed cgi client since it was duplicating the functionality
Fixed:
+ . properly quote the email address and "real name" in all situations using the
+ 'email' module if it is available and 'rfc822' otherwise
. #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
diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py
index 1c49b6fc3c1d7314f6302572b92308ab3d0d5718..755594c7ebbdc7f63e76042a4593ef590a290611 100644 (file)
--- a/roundup/roundupdb.py
+++ b/roundup/roundupdb.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: roundupdb.py,v 1.56 2002-06-14 03:54:21 dman13 Exp $
+# $Id: roundupdb.py,v 1.57 2002-06-15 15:49:29 dman13 Exp $
__doc__ = """
Extending hyperdb with types specific to issue-tracking.
import re, os, smtplib, socket, copy, time, random
import MimeWriter, cStringIO
import base64, quopri, mimetypes
-import rfc822
+# if available, use the 'email' module, otherwise fallback to 'rfc822'
+try :
+ from email.Utils import dump_address_pair as straddr
+except ImportError :
+ from rfc822 import dump_address_pair as straddr
import hyperdb, date
authname = users.get(authid, 'username')
authaddr = users.get(authid, 'address')
if authaddr:
- authaddr = rfc822.dump_address_pair( ('',authaddr) )
+ authaddr = straddr( ('',authaddr) )
else:
authaddr = ''
writer = MimeWriter.MimeWriter(message)
writer.addheader('Subject', '[%s%s] %s'%(cn, nodeid, title))
writer.addheader('To', ', '.join(sendto))
- writer.addheader('From', rfc822.dump_address_pair(
+ writer.addheader('From', straddr(
(authname, self.db.config.ISSUE_TRACKER_EMAIL) ) )
- writer.addheader('Reply-To', rfc822.dump_address_pair(
+ writer.addheader('Reply-To', straddr(
(self.db.config.INSTANCE_NAME,
self.db.config.ISSUE_TRACKER_EMAIL) ) )
writer.addheader('MIME-Version', '1.0')
# 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
- if not isinstance( base , "" ) or not base.startswith( "http://" ) :
+ # Oops, can't do this in python2.1
+ #if not isinstance( base , "" ) or not base.startswith( "http://" ) :
+ if type(base) != type("") or not base.startswith( "http://" ) :
base = "Configuration Error: ISSUE_TRACKER_WEB isn't a fully-qualified URL"
elif base[-1] != '/' :
base += '/'
web = base + 'issue'+ nodeid
- #web = self.db.config.ISSUE_TRACKER_WEB + 'issue'+ nodeid
# ensure the email address is properly quoted
- email = rfc822.dump_address_pair( self.db.config.INSTANCE_NAME ,
- self.db.config.ISSUE_TRACKER_EMAIL )
+ email = straddr( (self.db.config.INSTANCE_NAME ,
+ self.db.config.ISSUE_TRACKER_EMAIL) )
line = '_' * max(len(web), len(email))
return '%s\n%s\n%s\n%s'%(line, email, web, line)
changed = {}
props = cl.getprops(protected=0)
+ # XXX DSH
+ # Temporary work-around to prevent crashes and allow the issue to be
+ # submitted.
+ try :
+ oldvalues.keys
+ except AttributeError :
+ # The arg isn't a dict. Precondition/interface violation.
+ return '\n'.join(
+ ('', '-'*10,
+ "Precondition/interface Error -- 'oldvalues' isn't a dict." ,
+ '-'*10 , '' , str(oldvalues) ) )
+
# determine what changed
for key in oldvalues.keys():
if key in ['files','messages']: continue
#
# $Log: not supported by cvs2svn $
+# Revision 1.56 2002/06/14 03:54:21 dman13
+# #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
+#
# Revision 1.55 2002/06/11 04:58:07 richard
# detabbing
#