summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ac6b05b)
raw | patch | inline | side by side (parent: ac6b05b)
author | rochecompaan <rochecompaan@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 30 Nov 2001 11:29:04 +0000 (11:29 +0000) | ||
committer | rochecompaan <rochecompaan@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 30 Nov 2001 11:29:04 +0000 (11:29 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@437 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/roundupdb.py | patch | blob | history | |
roundup/templates/classic/detectors/nosyreaction.py | patch | blob | history | |
roundup/templates/extended/detectors/nosyreaction.py | patch | blob | history |
diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py
index 7aa5767a463859be82428351ea7eef743191ae51..4b94a10bfb72cea8a2ef34656e3543b6b8cd8636 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.23 2001-11-27 03:17:13 richard Exp $
+# $Id: roundupdb.py,v 1.24 2001-11-30 11:29:04 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, oldvalues):
"""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
authaddr = ' <%s>'%authaddr
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))
+ m.append(self.email_signature(nodeid, msgid, change_note))
# add author information
- if len(self.db.issue.get(nodeid, 'messages')) == 1:
- m.append("New submission from %s%s:"%(authname, authaddr))
- else:
+ if oldvalues:
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(self.db.msg.get(msgid, 'content'))
- # "list information" footer
+ # put in roundup's signature
if self.EMAIL_SIGNATURE_POSITION == 'bottom':
- m.append(self.email_signature(nodeid, msgid))
+ m.append(self.email_signature(nodeid, msgid, change_note))
# get the files for this message
files = self.db.msg.get(msgid, 'files')
raise MessageSendError, \
"Couldn't send confirmation email: %s"%value
- def email_signature(self, nodeid, msgid):
+ def email_signature(self, nodeid, msgid, change_note):
''' 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'%(line, email, web, line)
+ return '%s\n%s\n%s\n%s\n%s'%(line, email, web, change_note, line)
+
+ def generateChangeNote(self, nodeid, oldvalues):
+ """Generate a change note that lists property changes
+ """
+ cn = self.classname
+ cl = self.db.classes[cn]
+ changed = {}
+ props = cl.getprops(protected=0)
+
+ # determine what changed
+ for key in props.keys():
+ if key in ['files','messages']: continue
+ new_value = cl.get(nodeid, key)
+ # the old value might be non existent
+ try:
+ old_value = oldvalues[key]
+ if type(old_value) is type([]):
+ old_value.sort()
+ new_value.sort()
+ if old_value != new_value:
+ changed[key] = old_value
+ except:
+ old_value = None
+ changed[key] = old_value
+
+ # list the changes
+ m = []
+ for propname, oldvalue in changed.items():
+ prop = cl.properties[propname]
+ value = cl.get(nodeid, propname, None)
+ change = '%s -> %s'%(oldvalue, value)
+ if isinstance(prop, hyperdb.Link):
+ link = self.db.classes[prop.classname]
+ key = link.labelprop(default_to_id=1)
+ if key:
+ if value:
+ value = link.get(value, key)
+ else:
+ value = ''
+ if oldvalue:
+ oldvalue = link.get(oldvalue, key)
+ else:
+ oldvalue = ''
+ change = '%s -> %s'%(oldvalue, 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)
+ if oldvalue is None: oldvalue = []
+ # check for additions
+ for entry in value:
+ if entry in oldvalue: continue
+ if key:
+ l.append(link.get(entry, key))
+ else:
+ l.append(entry)
+ if l:
+ change = '+%s'%(', '.join(l))
+ l = []
+ # check for removals
+ for entry in oldvalue:
+ if entry in value: continue
+ if key:
+ l.append(link.get(entry, key))
+ else:
+ l.append(entry)
+ if l:
+ change = change + ' -%s'%(', '.join(l))
+ m.append('%s: %s'%(propname, change))
+ return '\n'.join(m)
#
# $Log: not supported by cvs2svn $
+# Revision 1.23 2001/11/27 03:17:13 richard
+# oops
+#
# Revision 1.22 2001/11/27 03:00:50 richard
# couple of bugfixes from latest patch integration
#
diff --git a/roundup/templates/classic/detectors/nosyreaction.py b/roundup/templates/classic/detectors/nosyreaction.py
index 6f84a39498a8ef257b0587f88401d41d6ae6c39e..c942e8389cc93237befe5562d136caf81ec54066 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: nosyreaction.py,v 1.6 2001-11-26 22:55:56 richard Exp $
+#$Id: nosyreaction.py,v 1.7 2001-11-30 11:29:04 rochecompaan Exp $
from roundup import roundupdb
# send a copy to the nosy list
for msgid in messages:
try:
- cl.sendmessage(nodeid, msgid)
+ cl.sendmessage(nodeid, msgid, oldvalues)
except roundupdb.MessageSendError, message:
raise roundupdb.DetectorError, message
#
#$Log: not supported by cvs2svn $
+#Revision 1.6 2001/11/26 22:55:56 richard
+#Feature:
+# . Added INSTANCE_NAME to configuration - used in web and email to identify
+# the instance.
+# . Added EMAIL_SIGNATURE_POSITION to indicate where to place the roundup
+# signature info in e-mails.
+# . Some more flexibility in the mail gateway and more error handling.
+# . Login now takes you to the page you back to the were denied access to.
+#
+#Fixed:
+# . Lots of bugs, thanks Roché and others on the devel mailing list!
+#
#Revision 1.5 2001/11/12 22:01:07 richard
#Fixed issues with nosy reaction and author copies.
#
diff --git a/roundup/templates/extended/detectors/nosyreaction.py b/roundup/templates/extended/detectors/nosyreaction.py
index dc7ff83449121099bdc34e541be67a4f349ec533..dc2b84c7efef8f027305f072116e7e31ae445dfb 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: nosyreaction.py,v 1.6 2001-11-26 22:55:56 richard Exp $
+#$Id: nosyreaction.py,v 1.7 2001-11-30 11:29:04 rochecompaan Exp $
from roundup import roundupdb
# send a copy to the nosy list
for msgid in messages:
try:
- cl.sendmessage(nodeid, msgid)
+ cl.sendmessage(nodeid, msgid, oldvalues)
except roundupdb.MessageSendError, message:
raise roundupdb.DetectorError, message
#
#$Log: not supported by cvs2svn $
+#Revision 1.6 2001/11/26 22:55:56 richard
+#Feature:
+# . Added INSTANCE_NAME to configuration - used in web and email to identify
+# the instance.
+# . Added EMAIL_SIGNATURE_POSITION to indicate where to place the roundup
+# signature info in e-mails.
+# . Some more flexibility in the mail gateway and more error handling.
+# . Login now takes you to the page you back to the were denied access to.
+#
+#Fixed:
+# . Lots of bugs, thanks Roché and others on the devel mailing list!
+#
#Revision 1.5 2001/11/12 22:01:07 richard
#Fixed issues with nosy reaction and author copies.
#