Skip to content

Commit fcca660

Browse files
author
Richard Jones
committed
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
1 parent cf4d64d commit fcca660

File tree

8 files changed

+114
-86
lines changed

8 files changed

+114
-86
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ are given with the most recent entry first.
1313
- force non-word boundary to match re: in subject (sf bug 626303)
1414
- handle sqlite bug (<2.7.2) (sf bug 630828)
1515
- handle missing props in anydbm stringFind
16+
- updated email package address formatting (deprecation)
17+
- copied email address quoting from email v2.4.3 so we're consistent with 2.2
18+
- email summary extraction now takes the first whole sentence or line -
19+
whichever is longer
1620

1721

1822
2002-10-16 0.5.1

TODO.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pending hyperdb range searching of values (dates in particular).
1515
comparison functions: lt, le, eq, ge, gt. eq and
1616
[value, value, ...] implies "in"
1717
pending hyperdb migrate "id" property to be Number type
18+
pending hyperdb multilink sorting by length is dumb
1819
pending tracker split instance.open() into open() and login()
1920
pending mailgw allow commands (feature request #556996)
2021
like "help", "dump issue123" (would send all info about
@@ -61,10 +62,8 @@ pending web search "refinement" - pre-fill the search page with the
6162
pending web column-heading sort stuff isn't implemented
6263

6364
active web UNIX init.d script for roundup-server
64-
bug docs need to mention somewhere how sorting works
65-
- it's mentioned in the design doc
66-
- multilink sorting by length is dumb
6765
bug web query editing isn't fully implemented
6866
bug web no testing for parsePropsFromForm
67+
active web revert to showing entire message in classic issue display
6968
======= ========= =============================================================
7069

doc/customizing.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Customising Roundup
33
===================
44

5-
:Version: $Revision: 1.60 $
5+
:Version: $Revision: 1.61 $
66

77
.. This document borrows from the ZopeBook section on ZPT. The original is at:
88
http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
@@ -2582,7 +2582,7 @@ able to give a summary of the total time spent on a particular issue.
25822582
Using a UN*X passwd file as the user database
25832583
---------------------------------------------
25842584

2585-
On some systems, the primary store of users is the UN*X passwd file. It holds
2585+
On some systems the primary store of users is the UN*X passwd file. It holds
25862586
information on users such as their username, real name, password and primary
25872587
user group.
25882588

@@ -2600,9 +2600,11 @@ day, or several times an hour if more immediate access is needed. In short, it:
26002600

26012601
1. parses the passwd file, finding usernames, passwords and real names,
26022602
2. compares that list to the current roundup user list:
2603+
26032604
a. entries no longer in the passwd file are *retired*
26042605
b. entries with mismatching real names are *updated*
26052606
c. entries only exist in the passwd file are *created*
2607+
26062608
3. send an email to administrators to let them know what's been done.
26072609

26082610
The retiring and updating are simple operations, requiring only a call to

doc/index.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ project and those who just report bugs:
6565
Anthony Baxter,
6666
Jeff Blaine,
6767
Duncan Booth,
68+
Seb Brezel,
6869
Titus Brown,
6970
Roch'e Compaan,
7071
Engelbert Gruber,
@@ -74,6 +75,7 @@ James Kew,
7475
Detlef Lannert,
7576
Gordon McMillan,
7677
Patrick Ohly,
78+
Will Partain,
7779
Bernhard Reiter,
7880
Dougal Scott,
7981
Stefan Seefeld,

roundup/mailgw.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class node. Any parts of other types are each stored in separate files
7373
an exception, the original message is bounced back to the sender with the
7474
explanatory message given in the exception.
7575
76-
$Id: mailgw.py,v 1.98 2002-10-21 22:03:09 richard Exp $
76+
$Id: mailgw.py,v 1.99 2002-11-05 22:59:46 richard Exp $
7777
'''
7878

7979
import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
@@ -913,17 +913,16 @@ def parseContent(content, keep_citations, keep_body,
913913
l.append(section)
914914
continue
915915
# keep this section - it has reponse stuff in it
916-
if not summary:
917-
# and while we're at it, use the first non-quoted bit as
918-
# our summary
919-
summary = line
920916
lines = lines[lines.index(line):]
921917
section = '\n'.join(lines)
918+
# and while we're at it, use the first non-quoted bit as
919+
# our summary
920+
summary = section
922921

923922
if not summary:
924923
# if we don't have our summary yet use the first line of this
925924
# section
926-
summary = lines[0]
925+
summary = section
927926
elif signature.match(lines[0]) and 2 <= len(lines) <= 10:
928927
# lose any signature
929928
break
@@ -934,6 +933,16 @@ def parseContent(content, keep_citations, keep_body,
934933
# and add the section to the output
935934
l.append(section)
936935

936+
# figure the summary - find the first sentence-ending punctuation or the
937+
# first whole line, whichever is longest
938+
sentence = re.search(r'^([^!?\.]+[!?\.])', summary)
939+
if sentence:
940+
sentence = sentence.group(1)
941+
else:
942+
sentence = ''
943+
first = eol.split(summary)[0]
944+
summary = max(sentence, first)
945+
937946
# Now reconstitute the message content minus the bits we don't care
938947
# about.
939948
if not keep_body:

roundup/roundupdb.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: roundupdb.py,v 1.72 2002-10-08 07:28:34 richard Exp $
18+
# $Id: roundupdb.py,v 1.73 2002-11-05 22:59:46 richard Exp $
1919

2020
__doc__ = """
2121
Extending hyperdb with types specific to issue-tracking.
@@ -26,9 +26,19 @@
2626
import base64, quopri, mimetypes
2727
# if available, use the 'email' module, otherwise fallback to 'rfc822'
2828
try :
29-
from email.Utils import dump_address_pair as straddr
29+
from email.Utils import formataddr as straddr
3030
except ImportError :
31-
from rfc822 import dump_address_pair as straddr
31+
# code taken from the email package 2.4.3
32+
def straddr(pair, specialsre = re.compile(r'[][\()<>@,:;".]'),
33+
escapesre = re.compile(r'[][\()"]')):
34+
name, address = pair
35+
if name:
36+
quotes = ''
37+
if specialsre.search(name):
38+
quotes = '"'
39+
name = escapesre.sub(r'\\\g<0>', name)
40+
return '%s%s%s <%s>' % (quotes, name, quotes, address)
41+
return address
3242

3343
import hyperdb
3444

roundup/scripts/roundup_server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#
1717
""" HTTP Server that serves roundup.
1818
19-
$Id: roundup_server.py,v 1.14 2002-10-08 03:31:09 richard Exp $
19+
$Id: roundup_server.py,v 1.15 2002-11-05 22:59:46 richard Exp $
2020
"""
2121

2222
# python version check
@@ -158,6 +158,7 @@ def inner_run_cgi(self):
158158
co = filter(None, self.headers.getheaders('cookie'))
159159
if co:
160160
env['HTTP_COOKIE'] = ', '.join(co)
161+
env['HTTP_AUTHORIZATION'] = self.headers.getheader('authorization')
161162
env['SCRIPT_NAME'] = ''
162163
env['SERVER_NAME'] = self.server.server_name
163164
env['SERVER_PORT'] = str(self.server.server_port)

0 commit comments

Comments
 (0)