From 0fb7b386ffbd9e79cef2917739fedd30202ef0cd Mon Sep 17 00:00:00 2001 From: rochecompaan Date: Fri, 30 Nov 2001 20:28:10 +0000 Subject: [PATCH] Property changes are now completely traceable, whether changes are made through the web or by email git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@440 57a73879-2fb5-44c3-a270-3262357dd7e2 --- roundup/cgi_client.py | 43 +++++++++++-------------------------------- roundup/roundupdb.py | 39 ++++++++++++++++++++++++--------------- 2 files changed, 35 insertions(+), 47 deletions(-) diff --git a/roundup/cgi_client.py b/roundup/cgi_client.py index 478cda0..02560d9 100644 --- a/roundup/cgi_client.py +++ b/roundup/cgi_client.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: cgi_client.py,v 1.70 2001-11-30 00:06:29 richard Exp $ +# $Id: cgi_client.py,v 1.71 2001-11-30 20:28:10 rochecompaan Exp $ __doc__ = """ WWW request handler (also used in the stand-alone server). @@ -332,8 +332,10 @@ class Client: note = self.form['__note'] note = note.value if changed or note: + p = self._post_editnode(self.nodeid, changed) + props['messages'] = p['messages'] + props['files'] = p['files'] cl.set(self.nodeid, **props) - self._post_editnode(self.nodeid, changed) # and some nice feedback for the user message = _('%(changes)s edited ok')%{'changes': ', '.join(changed)} @@ -499,34 +501,6 @@ class Client: ' the web.\n')%{'classname': cn} m = [summary] - # figure the changes and add them to the message - first = 1 - for name, prop in props.items(): - if changes is not None and name not in changes: continue - if first: - m.append('\n-------') - first = 0 - value = cl.get(nid, name, None) - if isinstance(prop, hyperdb.Link): - link = self.db.classes[prop.classname] - key = link.labelprop(default_to_id=1) - if value is not None and key: - value = link.get(value, key) - else: - value = '-' - elif isinstance(prop, hyperdb.Multilink): - if value is None: value = [] - l = [] - link = self.db.classes[prop.classname] - key = link.labelprop(default_to_id=1) - for entry in value: - if key: - l.append(link.get(entry, key)) - else: - l.append(entry) - value = ', '.join(l) - m.append('%s: %s'%(name, value)) - # now create the message content = '\n'.join(m) message_id = self.db.msg.create(author=self.getuid(), @@ -535,7 +509,7 @@ class Client: messages = cl.get(nid, 'messages') messages.append(message_id) props = {'messages': messages, 'files': files} - cl.set(nid, **props) + return props def newnode(self, message=None): ''' Add a new node to the database. @@ -568,7 +542,8 @@ class Client: props = {} try: nid = self._createnode() - self._post_editnode(nid) + props = self._post_editnode(nid) + cl.set(nid, **props) # and some nice feedback for the user message = _('%(classname)s created ok')%{'classname': cn} except: @@ -1049,6 +1024,10 @@ def parsePropsFromForm(db, cl, form, nodeid=0): # # $Log: not supported by cvs2svn $ +# Revision 1.70 2001/11/30 00:06:29 richard +# Converted roundup/cgi_client.py to use _() +# Added the status file, I18N_PROGRESS.txt +# # Revision 1.69 2001/11/29 23:19:51 richard # Removed the "This issue has been edited through the web" when a valid # change note is supplied. diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py index 4b94a10..c0b6201 100644 --- a/roundup/roundupdb.py +++ b/roundup/roundupdb.py @@ -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 @@ class IssueClass(Class): 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 @@ class IssueClass(Class): 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 @@ class IssueClass(Class): 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 @@ class IssueClass(Class): 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 @@ class IssueClass(Class): 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 @@ class IssueClass(Class): 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 @@ class IssueClass(Class): 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 @@ class IssueClass(Class): 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 # -- 2.30.2