diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py
index 1d15ab4f6b13bcca5aff159f24bacdf06a5b0c7e..6cb939a2b988665f5234c97c2eb1b29e47e0d70e 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.27 2001-12-10 21:02:53 richard Exp $
+# $Id: roundupdb.py,v 1.31 2001-12-15 19:24:39 rochecompaan Exp $
__doc__ = """
Extending hyperdb with types specific to issue-tracking.
appended to the "messages" field of the specified issue.
"""
- def sendmessage(self, nodeid, msgid):
+ def sendmessage(self, nodeid, msgid, change_note):
"""Send a message to the members of an issue's nosy list.
The message is sent only to users on the nosy list who are not
# add the content
m.append(self.db.msg.get(msgid, 'content'))
+ # add the change note
+ if change_note:
+ m.append(change_note)
+
# put in roundup's signature
if self.EMAIL_SIGNATURE_POSITION == 'bottom':
m.append(self.email_signature(nodeid, msgid))
writer = MimeWriter.MimeWriter(message)
writer.addheader('Subject', '[%s%s] %s'%(cn, nodeid, title))
writer.addheader('To', ', '.join(sendto))
- writer.addheader('From', '%s <%s>'%(self.INSTANCE_NAME,
- self.ISSUE_TRACKER_EMAIL))
+ writer.addheader('From', '%s <%s>'%(authname, self.ISSUE_TRACKER_EMAIL))
writer.addheader('Reply-To', '%s <%s>'%(self.INSTANCE_NAME,
self.ISSUE_TRACKER_EMAIL))
writer.addheader('MIME-Version', '1.0')
# now try to send the message
try:
smtp = smtplib.SMTP(self.MAILHOST)
- smtp.sendmail(self.ISSUE_TRACKER_EMAIL, sendto, message.getvalue())
+ # send the message as admin so bounces are sent there instead
+ # of to roundup
+ smtp.sendmail(self.ADMIN_EMAIL, sendto, message.getvalue())
except socket.error, value:
raise MessageSendError, \
"Couldn't send confirmation email: mailhost %s"%value
line = '_' * max(len(web), len(email))
return '%s\n%s\n%s\n%s'%(line, email, web, line)
- def generateChangeNote(self, nodeid, newvalues):
+ def generateChangeNote(self, nodeid, oldvalues):
"""Generate a change note that lists property changes
"""
cn = self.classname
props = cl.getprops(protected=0)
# determine what changed
- for key in newvalues.keys():
+ for key in oldvalues.keys():
if key in ['files','messages']: continue
- new_value = newvalues[key]
+ new_value = cl.get(nodeid, key)
# the old value might be non existent
try:
- old_value = cl.get(nodeid, key)
- if type(old_value) is type([]):
- old_value.sort()
+ old_value = oldvalues[key]
+ if type(new_value) is type([]):
new_value.sort()
- if old_value != new_value:
- changed[key] = new_value
+ old_value.sort()
+ if new_value != old_value:
+ changed[key] = old_value
except:
changed[key] = new_value
# list the changes
- for propname, value in changed.items():
+ m = []
+ for propname, oldvalue in changed.items():
prop = cl.properties[propname]
- oldvalue = cl.get(nodeid, propname, None)
- change = '%s -> %s'%(oldvalue, value)
+ value = cl.get(nodeid, propname, None)
if isinstance(prop, hyperdb.Link):
link = self.db.classes[prop.classname]
key = link.labelprop(default_to_id=1)
l.append(entry)
if l:
change += ' -%s'%(', '.join(l))
+ else:
+ change = '%s -> %s'%(oldvalue, value)
m.append('%s: %s'%(propname, change))
if m:
- m.insert(0, '')
m.insert(0, '----------')
+ m.insert(0, '')
return '\n'.join(m)
#
# $Log: not supported by cvs2svn $
+# Revision 1.30 2001/12/12 21:47:45 richard
+# . Message author's name appears in From: instead of roundup instance name
+# (which still appears in the Reply-To:)
+# . envelope-from is now set to the roundup-admin and not roundup itself so
+# delivery reports aren't sent to roundup (thanks Patrick Ohly)
+#
+# Revision 1.29 2001/12/11 04:50:49 richard
+# fixed the order of the blank line and '-------' line
+#
+# Revision 1.28 2001/12/10 22:20:01 richard
+# Enabled transaction support in the bsddb backend. It uses the anydbm code
+# where possible, only replacing methods where the db is opened (it uses the
+# btree opener specifically.)
+# Also cleaned up some change note generation.
+# Made the backends package work with pydoc too.
+#
+# Revision 1.27 2001/12/10 21:02:53 richard
+# only insert the -------- change note marker if there is a change note
+#
# Revision 1.26 2001/12/05 14:26:44 rochecompaan
# Removed generation of change note from "sendmessage" in roundupdb.py.
# The change note is now generated when the message is created.