Mercurial > p > roundup > code
changeset 1299:b2d04ce03802
Email improvements.
- updated email package address formatting (deprecation)
- copied email address quoting from email v2.4.3 so we're consistent with 2.2
- email summary extraction now takes the first whole sentence or line -
whichever is longer
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 05 Nov 2002 22:59:46 +0000 |
| parents | f0ab014eaf72 |
| children | 11ba3c565362 |
| files | CHANGES.txt TODO.txt doc/customizing.txt doc/index.txt roundup/mailgw.py roundup/roundupdb.py roundup/scripts/roundup_server.py test/test_mailgw.py |
| diffstat | 8 files changed, 114 insertions(+), 86 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Thu Oct 31 04:07:12 2002 +0000 +++ b/CHANGES.txt Tue Nov 05 22:59:46 2002 +0000 @@ -13,6 +13,10 @@ - force non-word boundary to match re: in subject (sf bug 626303) - handle sqlite bug (<2.7.2) (sf bug 630828) - handle missing props in anydbm stringFind +- updated email package address formatting (deprecation) +- copied email address quoting from email v2.4.3 so we're consistent with 2.2 +- email summary extraction now takes the first whole sentence or line - + whichever is longer 2002-10-16 0.5.1
--- a/TODO.txt Thu Oct 31 04:07:12 2002 +0000 +++ b/TODO.txt Tue Nov 05 22:59:46 2002 +0000 @@ -15,6 +15,7 @@ comparison functions: lt, le, eq, ge, gt. eq and [value, value, ...] implies "in" pending hyperdb migrate "id" property to be Number type +pending hyperdb multilink sorting by length is dumb pending tracker split instance.open() into open() and login() pending mailgw allow commands (feature request #556996) like "help", "dump issue123" (would send all info about @@ -61,10 +62,8 @@ pending web column-heading sort stuff isn't implemented active web UNIX init.d script for roundup-server -bug docs need to mention somewhere how sorting works - - it's mentioned in the design doc - - multilink sorting by length is dumb bug web query editing isn't fully implemented bug web no testing for parsePropsFromForm +active web revert to showing entire message in classic issue display ======= ========= =============================================================
--- a/doc/customizing.txt Thu Oct 31 04:07:12 2002 +0000 +++ b/doc/customizing.txt Tue Nov 05 22:59:46 2002 +0000 @@ -2,7 +2,7 @@ Customising Roundup =================== -:Version: $Revision: 1.60 $ +:Version: $Revision: 1.61 $ .. This document borrows from the ZopeBook section on ZPT. The original is at: http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx @@ -2582,7 +2582,7 @@ Using a UN*X passwd file as the user database --------------------------------------------- -On some systems, the primary store of users is the UN*X passwd file. It holds +On some systems the primary store of users is the UN*X passwd file. It holds information on users such as their username, real name, password and primary user group. @@ -2600,9 +2600,11 @@ 1. parses the passwd file, finding usernames, passwords and real names, 2. compares that list to the current roundup user list: + a. entries no longer in the passwd file are *retired* b. entries with mismatching real names are *updated* c. entries only exist in the passwd file are *created* + 3. send an email to administrators to let them know what's been done. The retiring and updating are simple operations, requiring only a call to
--- a/doc/index.txt Thu Oct 31 04:07:12 2002 +0000 +++ b/doc/index.txt Tue Nov 05 22:59:46 2002 +0000 @@ -65,6 +65,7 @@ Anthony Baxter, Jeff Blaine, Duncan Booth, +Seb Brezel, Titus Brown, Roch'e Compaan, Engelbert Gruber, @@ -74,6 +75,7 @@ Detlef Lannert, Gordon McMillan, Patrick Ohly, +Will Partain, Bernhard Reiter, Dougal Scott, Stefan Seefeld,
--- a/roundup/mailgw.py Thu Oct 31 04:07:12 2002 +0000 +++ b/roundup/mailgw.py Tue Nov 05 22:59:46 2002 +0000 @@ -73,7 +73,7 @@ an exception, the original message is bounced back to the sender with the explanatory message given in the exception. -$Id: mailgw.py,v 1.98 2002-10-21 22:03:09 richard Exp $ +$Id: mailgw.py,v 1.99 2002-11-05 22:59:46 richard Exp $ ''' import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri @@ -913,17 +913,16 @@ l.append(section) continue # keep this section - it has reponse stuff in it - if not summary: - # and while we're at it, use the first non-quoted bit as - # our summary - summary = line lines = lines[lines.index(line):] section = '\n'.join(lines) + # and while we're at it, use the first non-quoted bit as + # our summary + summary = section if not summary: # if we don't have our summary yet use the first line of this # section - summary = lines[0] + summary = section elif signature.match(lines[0]) and 2 <= len(lines) <= 10: # lose any signature break @@ -934,6 +933,16 @@ # and add the section to the output l.append(section) + # figure the summary - find the first sentence-ending punctuation or the + # first whole line, whichever is longest + sentence = re.search(r'^([^!?\.]+[!?\.])', summary) + if sentence: + sentence = sentence.group(1) + else: + sentence = '' + first = eol.split(summary)[0] + summary = max(sentence, first) + # Now reconstitute the message content minus the bits we don't care # about. if not keep_body:
--- a/roundup/roundupdb.py Thu Oct 31 04:07:12 2002 +0000 +++ b/roundup/roundupdb.py Tue Nov 05 22:59:46 2002 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: roundupdb.py,v 1.72 2002-10-08 07:28:34 richard Exp $ +# $Id: roundupdb.py,v 1.73 2002-11-05 22:59:46 richard Exp $ __doc__ = """ Extending hyperdb with types specific to issue-tracking. @@ -26,9 +26,19 @@ import base64, quopri, mimetypes # if available, use the 'email' module, otherwise fallback to 'rfc822' try : - from email.Utils import dump_address_pair as straddr + from email.Utils import formataddr as straddr except ImportError : - from rfc822 import dump_address_pair as straddr + # code taken from the email package 2.4.3 + def straddr(pair, specialsre = re.compile(r'[][\()<>@,:;".]'), + escapesre = re.compile(r'[][\()"]')): + name, address = pair + if name: + quotes = '' + if specialsre.search(name): + quotes = '"' + name = escapesre.sub(r'\\\g<0>', name) + return '%s%s%s <%s>' % (quotes, name, quotes, address) + return address import hyperdb
--- a/roundup/scripts/roundup_server.py Thu Oct 31 04:07:12 2002 +0000 +++ b/roundup/scripts/roundup_server.py Tue Nov 05 22:59:46 2002 +0000 @@ -16,7 +16,7 @@ # """ HTTP Server that serves roundup. -$Id: roundup_server.py,v 1.14 2002-10-08 03:31:09 richard Exp $ +$Id: roundup_server.py,v 1.15 2002-11-05 22:59:46 richard Exp $ """ # python version check @@ -158,6 +158,7 @@ co = filter(None, self.headers.getheaders('cookie')) if co: env['HTTP_COOKIE'] = ', '.join(co) + env['HTTP_AUTHORIZATION'] = self.headers.getheader('authorization') env['SCRIPT_NAME'] = '' env['SERVER_NAME'] = self.server.server_name env['SERVER_PORT'] = str(self.server.server_port)
--- a/test/test_mailgw.py Thu Oct 31 04:07:12 2002 +0000 +++ b/test/test_mailgw.py Tue Nov 05 22:59:46 2002 +0000 @@ -8,7 +8,7 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# $Id: test_mailgw.py,v 1.32 2002-09-26 03:04:24 richard Exp $ +# $Id: test_mailgw.py,v 1.33 2002-11-05 22:59:46 richard Exp $ import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib @@ -81,13 +81,14 @@ # and open the database self.db = self.instance.open('admin') self.db.user.create(username='Chef', address='chef@bork.bork.bork', - roles='User') + realname='Bork, Chef', roles='User') self.db.user.create(username='richard', address='richard@test', roles='User') self.db.user.create(username='mary', address='mary@test', - roles='User') + roles='User', realname='Contrary, Mary') self.db.user.create(username='john', address='john@test', - alternate_addresses='jondoe@test\njohn.doe@test', roles='User') + alternate_addresses='jondoe@test\njohn.doe@test', roles='User', + realname='John Doe') def tearDown(self): if os.path.exists(os.environ['SENDMAILDEBUG']): @@ -204,15 +205,15 @@ Content-Type: text/plain Subject: [issue1] Testing... To: chef@bork.bork.bork, mary@test, richard@test -From: "Chef" <issue_tracker@your.tracker.email.domain.example> -Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +From: "Bork, Chef" <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 Content-Transfer-Encoding: quoted-printable -New submission from Chef <chef@bork.bork.bork>: +New submission from Bork, Chef <chef@bork.bork.bork>: This is a test submission of a new issue. @@ -223,10 +224,10 @@ nosy: Chef, mary, richard status: unread title: Testing... -_________________________________________________________________________ -"Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +_______________________________________________________________________ +Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> http://your.tracker.url.example/issue1 -_________________________________________________________________________ +_______________________________________________________________________ ''') # BUG @@ -259,8 +260,8 @@ Content-Type: text/plain Subject: [issue1] Testing... To: chef@bork.bork.bork, richard@test -From: "mary" <issue_tracker@your.tracker.email.domain.example> -Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +From: "Contrary, Mary" <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: <followup_dummy_id> In-Reply-To: <dummy_test_message_id> @@ -268,17 +269,17 @@ Content-Transfer-Encoding: quoted-printable -mary <mary@test> added the comment: +Contrary, Mary <mary@test> added the comment: This is a second followup ---------- status: unread -> chatting -_________________________________________________________________________ -"Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +_______________________________________________________________________ +Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> http://your.tracker.url.example/issue1 -_________________________________________________________________________ +_______________________________________________________________________ ''') def testFollowup(self): @@ -307,8 +308,8 @@ Content-Type: text/plain Subject: [issue1] Testing... To: chef@bork.bork.bork, john@test, mary@test -From: "richard" <issue_tracker@your.tracker.email.domain.example> -Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +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: <followup_dummy_id> In-Reply-To: <dummy_test_message_id> @@ -325,10 +326,10 @@ assignedto: -> mary nosy: +john, mary status: unread -> chatting -_________________________________________________________________________ -"Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +_______________________________________________________________________ +Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> http://your.tracker.url.example/issue1 -_________________________________________________________________________ +_______________________________________________________________________ ''') def testFollowupTitleMatch(self): @@ -353,8 +354,8 @@ Content-Type: text/plain Subject: [issue1] Testing... To: chef@bork.bork.bork, john@test, mary@test -From: "richard" <issue_tracker@your.tracker.email.domain.example> -Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +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: <followup_dummy_id> In-Reply-To: <dummy_test_message_id> @@ -371,10 +372,10 @@ assignedto: -> mary nosy: +john, mary status: unread -> chatting -_________________________________________________________________________ -"Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +_______________________________________________________________________ +Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> http://your.tracker.url.example/issue1 -_________________________________________________________________________ +_______________________________________________________________________ ''') def testFollowupNosyAuthor(self): @@ -400,8 +401,8 @@ Content-Type: text/plain Subject: [issue1] Testing... To: chef@bork.bork.bork, richard@test -From: "john" <issue_tracker@your.tracker.email.domain.example> -Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +From: John Doe <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: <followup_dummy_id> In-Reply-To: <dummy_test_message_id> @@ -409,7 +410,7 @@ Content-Transfer-Encoding: quoted-printable -john <john@test> added the comment: +John Doe <john@test> added the comment: This is a followup @@ -417,10 +418,10 @@ ---------- nosy: +john status: unread -> chatting -_________________________________________________________________________ -"Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +_______________________________________________________________________ +Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> http://your.tracker.url.example/issue1 -_________________________________________________________________________ +_______________________________________________________________________ ''') @@ -448,8 +449,8 @@ Content-Type: text/plain Subject: [issue1] Testing... To: chef@bork.bork.bork -From: "richard" <issue_tracker@your.tracker.email.domain.example> -Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +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: <followup_dummy_id> In-Reply-To: <dummy_test_message_id> @@ -465,10 +466,10 @@ ---------- nosy: +john status: unread -> chatting -_________________________________________________________________________ -"Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +_______________________________________________________________________ +Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> http://your.tracker.url.example/issue1 -_________________________________________________________________________ +_______________________________________________________________________ ''') @@ -496,8 +497,8 @@ Content-Type: text/plain Subject: [issue1] Testing... To: chef@bork.bork.bork, john@test, richard@test -From: "john" <issue_tracker@your.tracker.email.domain.example> -Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +From: John Doe <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: <followup_dummy_id> In-Reply-To: <dummy_test_message_id> @@ -505,7 +506,7 @@ Content-Transfer-Encoding: quoted-printable -john <john@test> added the comment: +John Doe <john@test> added the comment: This is a followup @@ -513,10 +514,10 @@ ---------- nosy: +john status: unread -> chatting -_________________________________________________________________________ -"Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +_______________________________________________________________________ +Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> http://your.tracker.url.example/issue1 -_________________________________________________________________________ +_______________________________________________________________________ ''') @@ -543,8 +544,8 @@ Content-Type: text/plain Subject: [issue1] Testing... To: chef@bork.bork.bork, richard@test -From: "john" <issue_tracker@your.tracker.email.domain.example> -Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +From: John Doe <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: <followup_dummy_id> In-Reply-To: <dummy_test_message_id> @@ -552,17 +553,17 @@ Content-Transfer-Encoding: quoted-printable -john <john@test> added the comment: +John Doe <john@test> added the comment: This is a followup ---------- status: unread -> chatting -_________________________________________________________________________ -"Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +_______________________________________________________________________ +Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> http://your.tracker.url.example/issue1 -_________________________________________________________________________ +_______________________________________________________________________ ''') @@ -590,8 +591,8 @@ Content-Type: text/plain Subject: [issue1] Testing... To: chef@bork.bork.bork -From: "richard" <issue_tracker@your.tracker.email.domain.example> -Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +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: <followup_dummy_id> In-Reply-To: <dummy_test_message_id> @@ -606,10 +607,10 @@ ---------- status: unread -> chatting -_________________________________________________________________________ -"Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +_______________________________________________________________________ +Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> http://your.tracker.url.example/issue1 -_________________________________________________________________________ +_______________________________________________________________________ ''') @@ -698,8 +699,8 @@ Content-Type: text/plain Subject: [issue1] Testing... To: chef@bork.bork.bork, richard@test -From: "mary" <issue_tracker@your.tracker.email.domain.example> -Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +From: "Contrary, Mary" <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: <followup_dummy_id> In-Reply-To: <dummy_test_message_id> @@ -707,16 +708,16 @@ Content-Transfer-Encoding: quoted-printable -mary <mary@test> added the comment: +Contrary, Mary <mary@test> added the comment: A message with encoding (encoded oe =F6) ---------- status: unread -> chatting -_________________________________________________________________________ -"Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +_______________________________________________________________________ +Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> http://your.tracker.url.example/issue1 -_________________________________________________________________________ +_______________________________________________________________________ ''') @@ -752,8 +753,8 @@ Content-Type: text/plain Subject: [issue1] Testing... To: chef@bork.bork.bork, richard@test -From: "mary" <issue_tracker@your.tracker.email.domain.example> -Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +From: "Contrary, Mary" <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: <followup_dummy_id> In-Reply-To: <dummy_test_message_id> @@ -761,16 +762,16 @@ Content-Transfer-Encoding: quoted-printable -mary <mary@test> added the comment: +Contrary, Mary <mary@test> added the comment: A message with first part encoded (encoded oe =F6) ---------- status: unread -> chatting -_________________________________________________________________________ -"Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +_______________________________________________________________________ +Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> http://your.tracker.url.example/issue1 -_________________________________________________________________________ +_______________________________________________________________________ ''') def testFollowupStupidQuoting(self): @@ -796,8 +797,8 @@ Content-Type: text/plain Subject: [issue1] Testing... To: chef@bork.bork.bork -From: "richard" <issue_tracker@your.tracker.email.domain.example> -Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +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: <followup_dummy_id> In-Reply-To: <dummy_test_message_id> @@ -812,10 +813,10 @@ ---------- status: unread -> chatting -_________________________________________________________________________ -"Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> +_______________________________________________________________________ +Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> http://your.tracker.url.example/issue1 -_________________________________________________________________________ +_______________________________________________________________________ ''') def suite():
