Mercurial > p > roundup > code
diff roundup/roundupdb.py @ 428:7956563d49ae
Property changes are now completely traceable, whether changes are
made through the web or by email
| author | Roche Compaan <rochecompaan@users.sourceforge.net> |
|---|---|
| date | Fri, 30 Nov 2001 20:28:10 +0000 |
| parents | fc907b6ef135 |
| children | 2441743e335b |
line wrap: on
line diff
--- a/roundup/roundupdb.py Fri Nov 30 18:23:55 2001 +0000 +++ b/roundup/roundupdb.py Fri Nov 30 20:28:10 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.24 2001-11-30 11:29:04 rochecompaan Exp $ +# $Id: roundupdb.py,v 1.25 2001-11-30 20:28:10 rochecompaan Exp $ __doc__ = """ Extending hyperdb with types specific to issue-tracking. @@ -310,8 +310,19 @@ if rlen == len(recipients): return + # get the change note + if oldvalues: + change_note = self.generateChangeNote(nodeid, oldvalues) + else: + change_note = '' + + # add the change note to the message content + content = self.db.msg.get(msgid, 'content') + content += change_note + # update the message's recipients list self.db.msg.set(msgid, recipients=recipients) + self.db.msg.setcontent('msg', msgid, content) # send an email to the people who missed out sendto = [self.db.user.get(i, 'address') for i in recipients] @@ -327,18 +338,12 @@ else: authaddr = '' - # get the change note - if oldvalues: - change_note = self.generateChangeNote(nodeid, oldvalues) - else: - change_note = '' - # make the message body m = [''] # put in roundup's signature if self.EMAIL_SIGNATURE_POSITION == 'top': - m.append(self.email_signature(nodeid, msgid, change_note)) + m.append(self.email_signature(nodeid, msgid)) # add author information if oldvalues: @@ -348,11 +353,11 @@ m.append('') # add the content - m.append(self.db.msg.get(msgid, 'content')) + m.append(content) # put in roundup's signature if self.EMAIL_SIGNATURE_POSITION == 'bottom': - m.append(self.email_signature(nodeid, msgid, change_note)) + m.append(self.email_signature(nodeid, msgid)) # get the files for this message files = self.db.msg.get(msgid, 'files') @@ -364,7 +369,7 @@ writer.addheader('To', ', '.join(sendto)) writer.addheader('From', '%s <%s>'%(self.INSTANCE_NAME, self.ISSUE_TRACKER_EMAIL)) - writer.addheader('Reply-To:', '%s <%s>'%(self.INSTANCE_NAME, + writer.addheader('Reply-To', '%s <%s>'%(self.INSTANCE_NAME, self.ISSUE_TRACKER_EMAIL)) writer.addheader('MIME-Version', '1.0') @@ -413,13 +418,13 @@ raise MessageSendError, \ "Couldn't send confirmation email: %s"%value - def email_signature(self, nodeid, msgid, change_note): + def email_signature(self, nodeid, msgid): ''' Add a signature to the e-mail with some useful information ''' web = self.ISSUE_TRACKER_WEB + 'issue'+ nodeid email = '"%s" <%s>'%(self.INSTANCE_NAME, self.ISSUE_TRACKER_EMAIL) line = '_' * max(len(web), len(email)) - return '%s\n%s\n%s\n%s\n%s'%(line, email, web, change_note, line) + return '%s\n%s\n%s\n%s'%(line, email, web, line) def generateChangeNote(self, nodeid, oldvalues): """Generate a change note that lists property changes @@ -446,7 +451,7 @@ changed[key] = old_value # list the changes - m = [] + m = ['','----------'] for propname, oldvalue in changed.items(): prop = cl.properties[propname] value = cl.get(nodeid, propname, None) @@ -465,6 +470,7 @@ oldvalue = '' change = '%s -> %s'%(oldvalue, value) elif isinstance(prop, hyperdb.Multilink): + change = '' if value is None: value = [] l = [] link = self.db.classes[prop.classname] @@ -488,12 +494,15 @@ else: l.append(entry) if l: - change = change + ' -%s'%(', '.join(l)) + change += ' -%s'%(', '.join(l)) m.append('%s: %s'%(propname, change)) return '\n'.join(m) # # $Log: not supported by cvs2svn $ +# Revision 1.24 2001/11/30 11:29:04 rochecompaan +# Property changes are now listed in emails generated by Roundup +# # Revision 1.23 2001/11/27 03:17:13 richard # oops #
