Index: roundup/cgi/templating.py =================================================================== --- roundup/cgi/templating.py (revision 4205) +++ roundup/cgi/templating.py (working copy) @@ -1035,6 +1035,13 @@ cell[-1] += ' -> %s'%current[k] current[k] = old + # Omit 'non-journaled' properties: as all non-Link + # properties are always journaled, setting + # do_journal = False means 'omit from history/changes + # log' + elif hasattr(prop, 'do_journal') and not prop.do_journal: + continue + elif isinstance(prop, hyperdb.Date) and args[k]: if args[k] is None: d = '' Index: roundup/roundupdb.py =================================================================== --- roundup/roundupdb.py (revision 4205) +++ roundup/roundupdb.py (working copy) @@ -193,7 +193,7 @@ """ def nosymessage(self, nodeid, msgid, oldvalues, whichnosy='nosy', - from_address=None, cc=[], bcc=[]): + from_address=None, cc=[], bcc=[], quiet=False, mute=False): """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 @@ -212,6 +212,11 @@ message to that may not be specified in the message's recipients list. These recipients will not be included in the To: or Cc: address lists. + + If 'quiet' is true, properties with do_journal=False will be ignored. + + If 'mute' is true, no change note is appended (but changes are still + visible in headers). """ if msgid: authid = self.db.msg.get(msgid, 'author') @@ -261,10 +266,11 @@ if good_recipient(userid): add_recipient(userid, bcc_sendto) - if oldvalues: - note = self.generateChangeNote(nodeid, oldvalues) - else: - note = self.generateCreateNote(nodeid) + if not mute: + if oldvalues: + note = self.generateChangeNote(nodeid, oldvalues, quiet=quiet) + else: + note = self.generateCreateNote(nodeid, quiet=quiet) # If we have new recipients, update the message's recipients # and send the mail. @@ -527,8 +533,12 @@ return '\n%s\n%s\n<%s>\n%s'%(line, email, web, line) - def generateCreateNote(self, nodeid): + def generateCreateNote(self, nodeid, quiet=False): """Generate a create note that lists initial property values + + If 'quiet' is true, properties with 'do_journal=False' are ignored. + Even if 'quiet' is false, properties that aren't links are ignored + if they have a 'do_journal' attribute set to False. """ cn = self.classname cl = self.db.classes[cn] @@ -539,6 +549,8 @@ prop_items = props.items() prop_items.sort() for propname, prop in prop_items: + if quiet and hasattr(prop, 'do_journal') and not prop.do_journal: + continue value = cl.get(nodeid, propname, None) # skip boring entries if not value: @@ -561,6 +573,11 @@ value.sort() value = ', '.join(value) else: + # Omit 'non-journaled' properties: non-Link properties are + # always journaled, so setting .do_journal = False means + # 'omit from history/changes log' + if hasattr(prop, 'do_journal') and not prop.do_journal: + continue value = str(value) if '\n' in value: value = '\n'+self.indentChangeNoteValue(value) @@ -569,8 +586,12 @@ m.insert(0, '') return '\n'.join(m) - def generateChangeNote(self, nodeid, oldvalues): + def generateChangeNote(self, nodeid, oldvalues, quiet=False): """Generate a change note that lists property changes + + If 'quiet' is true, properties with 'do_journal=False' are ignored. + Even if 'quiet' is false, properties that aren't links are ignored + if they have a 'do_journal' attribute set to False. """ if not isinstance(oldvalues, type({})): raise TypeError("'oldvalues' must be dict-like, not %s."% @@ -611,6 +632,8 @@ changed_items.sort() for propname, oldvalue in changed_items: prop = props[propname] + if quiet and hasattr(prop, 'do_journal') and not prop.do_journal: + continue value = cl.get(nodeid, propname, None) if isinstance(prop, hyperdb.Link): link = self.db.classes[prop.classname] @@ -654,6 +677,11 @@ l.sort() change += ' -%s'%(', '.join(l)) else: + # Omit 'non-journaled' properties: non-Link properties are + # always journaled, so setting .do_journal = False means + # 'omit from history/change log' + if hasattr(prop, 'do_journal') and not prop.do_journal: + continue change = '%s -> %s'%(oldvalue, value) if '\n' in change: value = self.indentChangeNoteValue(str(value))