Update of /cvsroot/mailman/mailman/Mailman/Handlers
In directory sc8-pr-cvs1:/tmp/cvs-serv25374
Modified Files:
Tag: Release_2_1-maint
CookHeaders.py
Log Message:
uheader(): Added default argument for maxlinelen.
process(): Reworked the way we calculate the List-Id header in the
face of i18n descriptions which may need to be quoted (if ASCII and
containing RFC 2822 special chars).
What we do now is RFC 2047 encode just the description part, if there
is one, then use formataddr() to combine that with the email
address-like list identification.
Index: CookHeaders.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Handlers/CookHeaders.py,v
retrieving revision 2.33.2.4
retrieving revision 2.33.2.5
diff -u -d -r2.33.2.4 -r2.33.2.5
--- CookHeaders.py 13 Dec 2003 23:25:42 -0000 2.33.2.4
+++ CookHeaders.py 18 Dec 2003 14:57:29 -0000 2.33.2.5
@@ -39,7 +39,7 @@
def _isunicode(s):
return isinstance(s, UnicodeType)
-def uheader(mlist, s, header_name=None, continuation_ws='\t'):
+def uheader(mlist, s, header_name=None, continuation_ws='\t', maxlinelen=None):
# Get the charset to encode the string in. If this is us-ascii, we'll use
# iso-8859-1 instead, just to get a little extra coverage, and because the
# Header class tries us-ascii first anyway.
@@ -54,8 +54,7 @@
codec = charset.input_codec or 'ascii'
s = unicode(s, codec, 'replace')
# We purposefully leave no space b/w prefix and subject!
- return Header(s, charset, header_name=header_name,
- continuation_ws=continuation_ws)
+ return Header(s, charset, maxlinelen, header_name, continuation_ws)
@@ -164,16 +163,18 @@
# headers by default, pissing off their users. Too bad. Fix the MUAs.
if msgdata.get('_nolist') or not mlist.include_rfc2369_headers:
return
- # Pre-calculate
- listid = '<%s.%s>' % (mlist.internal_name(), mlist.host_name)
+ # This will act like an email address for purposes of formataddr()
+ listid = '%s.%s' % (mlist.internal_name(), mlist.host_name)
if mlist.description:
- # Make sure description is properly i18n'd
- listid_h = uheader(mlist, u'"' + mlist.description + u'"', 'List-Id')
- listid_h.append(listid, 'us-ascii')
+ # Don't wrap the header since here we just want to get it properly RFC
+ # 2047 encoded.
+ h = uheader(mlist, mlist.description, 'List-Id', maxlinelen=10000)
+ desc = str(h)
else:
- # For wrapping
- listid_h = Header(listid, 'us-ascii', header_name='List-Id')
- # We always add a List-ID: header.
+ desc = ''
+ listid_h = formataddr((desc, listid))
+ # We always add a List-ID: header. Do an parse/format roundtrip to
+ # properly quote any funny characters in the description.
del msg['list-id']
msg['List-Id'] = listid_h
# For internally crafted messages, we
_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
Unsubscribe: http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org