summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 430ffee)
raw | patch | inline | side by side (parent: 430ffee)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 23 Feb 2010 03:20:17 +0000 (03:20 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 23 Feb 2010 03:20:17 +0000 (03:20 +0000) |
In-Reply-To set to itself (thanks Eric Kow).
Also fix roundupdb IssueClass code to use the variable "issueid" instead of
the braindead "nodeid".
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4464 57a73879-2fb5-44c3-a270-3262357dd7e2
Also fix roundupdb IssueClass code to use the variable "issueid" instead of
the braindead "nodeid".
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4464 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/roundupdb.py | patch | blob | history | |
test/memorydb.py | patch | blob | history | |
test/test_mailgw.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index 3e8dfd9f1a30f934fbe5c451fa3eace7ca8f1f94..335d6898209bdc14426105af86c169f3b1b7cf56 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
This file contains the changes to the Roundup system over time. The entries
are given with the most recent entry first.
+2010-02-23 1.5.0
+
+Fixed:
+- The email for the first message on an issue was having its In-Reply-To
+ set to itself (thanks Eric Kow)
+
+
2010-02-19 1.4.13
Fixed:
diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py
index 5ba6b4512e03952a1b458f36b03053a01392dafc..45fb8e8b583c94829aa4cb30f60279194fff76bc 100644 (file)
--- a/roundup/roundupdb.py
+++ b/roundup/roundupdb.py
)
# New methods:
- def addmessage(self, nodeid, summary, text):
+ def addmessage(self, issueid, summary, text):
"""Add a message to an issue's mail spool.
A new "msg" node is constructed using the current date, the user that
appended to the "messages" field of the specified issue.
"""
- def nosymessage(self, nodeid, msgid, oldvalues, whichnosy='nosy',
+ def nosymessage(self, issueid, msgid, oldvalues, whichnosy='nosy',
from_address=None, cc=[], bcc=[]):
"""Send a message to the members of an issue's nosy list.
seen_message[authid] = 1
# now deal with the nosy and cc people who weren't recipients.
- for userid in cc + self.get(nodeid, whichnosy):
+ for userid in cc + self.get(issueid, whichnosy):
if good_recipient(userid):
add_recipient(userid, sendto)
add_recipient(userid, bcc_sendto)
if oldvalues:
- note = self.generateChangeNote(nodeid, oldvalues)
+ note = self.generateChangeNote(issueid, oldvalues)
else:
- note = self.generateCreateNote(nodeid)
+ note = self.generateCreateNote(issueid)
# If we have new recipients, update the message's recipients
# and send the mail.
if sendto or bcc_sendto:
if msgid is not None:
self.db.msg.set(msgid, recipients=recipients)
- self.send_message(nodeid, msgid, note, sendto, from_address,
+ self.send_message(issueid, msgid, note, sendto, from_address,
bcc_sendto)
# backwards compatibility - don't remove
sendmessage = nosymessage
- def send_message(self, nodeid, msgid, note, sendto, from_address=None,
+ def send_message(self, issueid, msgid, note, sendto, from_address=None,
bcc_sendto=[]):
- '''Actually send the nominated message from this node to the sendto
+ '''Actually send the nominated message from this issue to the sendto
recipients, with the note appended.
'''
users = self.db.user
# this is an old message that didn't get a messageid, so
# create one
messageid = "<%s.%s.%s%s@%s>"%(time.time(), random.random(),
- self.classname, nodeid,
+ self.classname, issueid,
self.db.config.MAIL_DOMAIN)
if msgid is not None:
messages.set(msgid, messageid=messageid)
# compose title
cn = self.classname
- title = self.get(nodeid, 'title') or '%s message copy'%cn
+ title = self.get(issueid, 'title') or '%s message copy'%cn
# figure author information
if msgid:
# put in roundup's signature
if self.db.config.EMAIL_SIGNATURE_POSITION == 'top':
- m.append(self.email_signature(nodeid, msgid))
+ m.append(self.email_signature(issueid, msgid))
# add author information
if authid and self.db.config.MAIL_ADD_AUTHORINFO:
- if msgid and len(self.get(nodeid, 'messages')) == 1:
+ if msgid and len(self.get(issueid, 'messages')) == 1:
m.append(_("New submission from %(authname)s%(authaddr)s:")
% locals())
elif msgid:
# put in roundup's signature
if self.db.config.EMAIL_SIGNATURE_POSITION == 'bottom':
- m.append(self.email_signature(nodeid, msgid))
+ m.append(self.email_signature(issueid, msgid))
# figure the encoding
charset = getattr(self.db.config, 'EMAIL_CHARSET', 'utf-8')
if from_tag:
from_tag = ' ' + from_tag
- subject = '[%s%s] %s'%(cn, nodeid, title)
+ subject = '[%s%s] %s'%(cn, issueid, title)
author = (authname + from_tag, from_address)
# send an individual message per recipient?
if not 'name' in cl.getprops():
continue
if isinstance(prop, hyperdb.Link):
- value = self.get(nodeid, propname)
+ value = self.get(issueid, propname)
if value is None:
continue
values = [value]
else:
- values = self.get(nodeid, propname)
+ values = self.get(issueid, propname)
if not values:
continue
values = [cl.get(v, 'name') for v in values]
if not inreplyto:
# Default the reply to the first message
- msgs = self.get(nodeid, 'messages')
+ msgs = self.get(issueid, 'messages')
# Assume messages are sorted by increasing message number here
# If the issue is just being created, and the submitter didn't
# provide a message, then msgs will be empty.
- if msgs and msgs[0] != nodeid:
+ if msgs and msgs[0] != msgid:
inreplyto = messages.get(msgs[0], 'messageid')
if inreplyto:
message['In-Reply-To'] = inreplyto
mailer.smtp_send(sendto, message.as_string())
first = False
- def email_signature(self, nodeid, msgid):
+ def email_signature(self, issueid, msgid):
''' Add a signature to the e-mail with some useful information
'''
# simplistic check to see if the url is valid,
else:
if not base.endswith('/'):
base = base + '/'
- web = base + self.classname + nodeid
+ web = base + self.classname + issueid
# ensure the email address is properly quoted
email = formataddr((self.db.config.TRACKER_NAME,
return '\n%s\n%s\n<%s>\n%s'%(line, email, web, line)
- def generateCreateNote(self, nodeid):
+ def generateCreateNote(self, issueid):
"""Generate a create note that lists initial property values
"""
cn = self.classname
prop_items = props.items()
prop_items.sort()
for propname, prop in prop_items:
- value = cl.get(nodeid, propname, None)
+ value = cl.get(issueid, propname, None)
# skip boring entries
if not value:
continue
m.insert(0, '')
return '\n'.join(m)
- def generateChangeNote(self, nodeid, oldvalues):
+ def generateChangeNote(self, issueid, oldvalues):
"""Generate a change note that lists property changes
"""
if not isinstance(oldvalues, type({})):
# not all keys from oldvalues might be available in database
# this happens when property was deleted
try:
- new_value = cl.get(nodeid, key)
+ new_value = cl.get(issueid, key)
except KeyError:
continue
# the old value might be non existent
changed_items.sort()
for propname, oldvalue in changed_items:
prop = props[propname]
- value = cl.get(nodeid, propname, None)
+ value = cl.get(issueid, propname, None)
if isinstance(prop, hyperdb.Link):
link = self.db.classes[prop.classname]
key = link.labelprop(default_to_id=1)
diff --git a/test/memorydb.py b/test/memorydb.py
index 17c8330f7c3029c86363a3603a04f1a84111e97c..2bbddabf511c403f76805234e87ce2bf80c863e0 100644 (file)
--- a/test/memorydb.py
+++ b/test/memorydb.py
from roundup.hyperdb import *
from roundup.support import ensureParentsExist
-def new_config():
+def new_config(debug=False):
config = configuration.CoreConfig()
config.DATABASE = "db"
#config.logging = MockNull()
# these TRACKER_WEB and MAIL_DOMAIN values are used in mailgw tests
+ if debug:
+ config.LOGGING_LEVEL = "DEBUG"
config.MAIL_DOMAIN = "your.tracker.email.domain.example"
config.TRACKER_WEB = "http://tracker.example/cgi-bin/roundup.cgi/bugs/"
return config
-def create(journaltag, create=True):
- db = Database(new_config(), journaltag)
+def create(journaltag, create=True, debug=False):
+ db = Database(new_config(debug), journaltag)
# load standard schema
schema = os.path.join(os.path.dirname(__file__),
diff --git a/test/test_mailgw.py b/test/test_mailgw.py
index b1e4db93c82a29b5254e5eedb8efe4360b55e937..78eef48094cd7ebfa9e6638777b96dddfc91e9c8 100644 (file)
--- a/test/test_mailgw.py
+++ b/test/test_mailgw.py
Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
_______________________________________________________________________
+''')
+
+ def testNosyGeneration(self):
+ self.db.issue.create(title='test')
+
+ # create a nosy message
+ msg = self.db.msg.create(content='This is a test',
+ author=self.richard_id, messageid='<dummy_test_message_id>')
+ self.db.journaltag = 'richard'
+ l = self.db.issue.create(title='test', messages=[msg],
+ nosy=[self.chef_id, self.mary_id, self.john_id])
+
+ self.compareMessages(self._get_mail(),
+'''FROM: roundup-admin@your.tracker.email.domain.example
+TO: chef@bork.bork.bork, john@test.test, mary@test.test
+Content-Type: text/plain; charset="utf-8"
+Subject: [issue2] test
+To: chef@bork.bork.bork, john@test.test, mary@test.test
+From: richard <issue_tracker@your.tracker.email.domain.example>
+Reply-To: Roundup issue tracker
+ <issue_tracker@your.tracker.email.domain.example>
+MIME-Version: 1.0
+Message-Id: <dummy_test_message_id>
+X-Roundup-Name: Roundup issue tracker
+X-Roundup-Loop: hello
+X-Roundup-Issue-Status: unread
+Content-Transfer-Encoding: quoted-printable
+
+
+New submission from richard <richard@test.test>:
+
+This is a test
+
+----------
+messages: 1
+nosy: Chef, john, mary, richard
+status: unread
+title: test
+
+_______________________________________________________________________
+Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
+<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue2>
+_______________________________________________________________________
''')
def testPropertyChangeOnly(self):
X-Roundup-Loop: hello
X-Roundup-Issue-Status: unread
X-Roundup-Version: 1.3.3
+In-Reply-To: <dummy_test_message_id>
MIME-Version: 1.0
Reply-To: Roundup issue tracker
<issue_tracker@your.tracker.email.domain.example>
charset="iso-8859-1"
From: Chef <chef@bork.bork.bork>
To: issue_tracker@your.tracker.email.domain.example
-Message-Id: <dummy_test_message_id>
+Message-Id: <dummy_test_message_id_2>
Subject: [issue%(id)s] Testing... [nosy=+mary]
Just a test reply
Reply-To: Roundup issue tracker
<issue_tracker@your.tracker.email.domain.example>
MIME-Version: 1.0
-Message-Id: <dummy_test_message_id>
+Message-Id: <dummy_test_message_id_2>
+In-Reply-To: <dummy_test_message_id>
X-Roundup-Name: Roundup issue tracker
X-Roundup-Loop: hello
X-Roundup-Issue-Status: chatting