diff -r 59de7ad827e2 roundup/roundupdb.py --- a/roundup/roundupdb.py Tue May 15 12:38:36 2012 +0200 +++ b/roundup/roundupdb.py Tue May 15 19:04:55 2012 -0400 @@ -35,6 +35,7 @@ from anypy.email_ import FeedParser from roundup import password, date, hyperdb +from roundup.configuration import NODEFAULT from roundup.i18n import _ from roundup.hyperdb import iter_roles @@ -621,23 +622,32 @@ ''' # simplistic check to see if the url is valid, # then append a trailing slash if it is missing + lines = [] + + # ensure the email address is properly quoted + email = formataddr((self.db.config.TRACKER_NAME, + self.db.config.TRACKER_EMAIL)) + lines.append(email) + base = self.db.config.TRACKER_WEB - if (not isinstance(base , type('')) or - not (base.startswith('http://') or base.startswith('https://'))): + if base in [NODEFAULT, None]: + web = None + elif (not isinstance(base , type('')) or + not (base.startswith('http://') or base.startswith('https://'))): web = "Configuration Error: TRACKER_WEB isn't a " \ "fully-qualified URL" else: if not base.endswith('/'): base = base + '/' web = base + self.classname + issueid + if web: + lines.append('<%s>' % web) - # ensure the email address is properly quoted - email = formataddr((self.db.config.TRACKER_NAME, - self.db.config.TRACKER_EMAIL)) - - line = '_' * max(len(web)+2, len(email)) - return '\n%s\n%s\n<%s>\n%s'%(line, email, web, line) - + maxlinelen = max(len(x) for x in lines) + line = '_' * maxlinelen + lines.insert(0, line) + lines.append(line) + return '\n' + '\n'.join(lines) def generateCreateNote(self, issueid): """Generate a create note that lists initial property values diff -r 59de7ad827e2 test/test_mailgw.py --- a/test/test_mailgw.py Tue May 15 12:38:36 2012 +0200 +++ b/test/test_mailgw.py Tue May 15 19:04:55 2012 -0400 @@ -1065,6 +1065,51 @@ self.assertEqual(f.content, content [n]) self.assertEqual(msg.content, 'First part: Text') + def testNODEFAULTWebSignature(self): + self.doNewIssue() + self.instance.config['TRACKER_WEB'] = None + message = '''Content-Type: text/plain; + charset="iso-8859-1" +From: mary +To: issue_tracker@your.tracker.email.domain.example +Message-Id: +In-Reply-To: +Subject: [issue1] Testing... + +This is a second followup +''' + self._handle_mail(message, trap_exc=1) + assert os.path.exists(SENDMAILDEBUG) + self.compareMessages(self._get_mail(), +'''FROM: roundup-admin@your.tracker.email.domain.example +TO: chef@bork.bork.bork, richard@test.test +Content-Type: text/plain; charset="utf-8" +Subject: [issue1] Testing... +To: chef@bork.bork.bork, richard@test.test +From: "Contrary, Mary" +Reply-To: Roundup issue tracker + +MIME-Version: 1.0 +Message-Id: +In-Reply-To: +X-Roundup-Name: Roundup issue tracker +X-Roundup-Loop: hello +X-Roundup-Issue-Status: chatting +Content-Transfer-Encoding: quoted-printable + + +Contrary, Mary added the comment: + +This is a second followup + +---------- +status: unread -> chatting + +_______________________________________________________________________ +Roundup issue tracker +_______________________________________________________________________ +''') + def testSimpleFollowup(self): self.doNewIssue() self._handle_mail('''Content-Type: text/plain;