Mercurial > p > roundup > code
diff roundup/roundupdb.py @ 434:2441743e335b
Removed generation of change note from "sendmessage" in roundupdb.py.
The change note is now generated when the message is created.
| author | Roche Compaan <rochecompaan@users.sourceforge.net> |
|---|---|
| date | Wed, 05 Dec 2001 14:26:44 +0000 |
| parents | 7956563d49ae |
| children | 6e27cb83aacb |
line wrap: on
line diff
--- a/roundup/roundupdb.py Tue Dec 04 01:25:08 2001 +0000 +++ b/roundup/roundupdb.py Wed Dec 05 14:26:44 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.25 2001-11-30 20:28:10 rochecompaan Exp $ +# $Id: roundupdb.py,v 1.26 2001-12-05 14:26:44 rochecompaan Exp $ __doc__ = """ Extending hyperdb with types specific to issue-tracking. @@ -268,7 +268,7 @@ appended to the "messages" field of the specified issue. """ - def sendmessage(self, nodeid, msgid, oldvalues): + def sendmessage(self, nodeid, msgid): """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 @@ -310,19 +310,8 @@ 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] @@ -346,14 +335,14 @@ m.append(self.email_signature(nodeid, msgid)) # add author information - if oldvalues: + if len(self.get(nodeid,'messages')) == 1: + m.append("New submission from %s%s:"%(authname, authaddr)) + else: m.append("%s%s added the comment:"%(authname, authaddr)) - else: - m.append("New submission from %s%s:"%(authname, authaddr)) m.append('') # add the content - m.append(content) + m.append(self.db.msg.get(msgid, 'content')) # put in roundup's signature if self.EMAIL_SIGNATURE_POSITION == 'bottom': @@ -426,7 +415,7 @@ line = '_' * max(len(web), len(email)) return '%s\n%s\n%s\n%s'%(line, email, web, line) - def generateChangeNote(self, nodeid, oldvalues): + def generateChangeNote(self, nodeid, newvalues): """Generate a change note that lists property changes """ cn = self.classname @@ -435,26 +424,25 @@ props = cl.getprops(protected=0) # determine what changed - for key in props.keys(): + for key in newvalues.keys(): if key in ['files','messages']: continue - new_value = cl.get(nodeid, key) + new_value = newvalues[key] # the old value might be non existent try: - old_value = oldvalues[key] + old_value = cl.get(nodeid, key) if type(old_value) is type([]): old_value.sort() new_value.sort() if old_value != new_value: - changed[key] = old_value + changed[key] = new_value except: - old_value = None - changed[key] = old_value + changed[key] = new_value # list the changes m = ['','----------'] - for propname, oldvalue in changed.items(): + for propname, value in changed.items(): prop = cl.properties[propname] - value = cl.get(nodeid, propname, None) + oldvalue = cl.get(nodeid, propname, None) change = '%s -> %s'%(oldvalue, value) if isinstance(prop, hyperdb.Link): link = self.db.classes[prop.classname] @@ -472,10 +460,10 @@ elif isinstance(prop, hyperdb.Multilink): change = '' if value is None: value = [] + if oldvalue is None: oldvalue = [] l = [] link = self.db.classes[prop.classname] key = link.labelprop(default_to_id=1) - if oldvalue is None: oldvalue = [] # check for additions for entry in value: if entry in oldvalue: continue @@ -500,6 +488,10 @@ # # $Log: not supported by cvs2svn $ +# Revision 1.25 2001/11/30 20:28:10 rochecompaan +# Property changes are now completely traceable, whether changes are +# made through the web or by email +# # Revision 1.24 2001/11/30 11:29:04 rochecompaan # Property changes are now listed in emails generated by Roundup #
