[Mailman-Developers] Mail-to-news gatewaying?
Brad Knowles
brad at stop.mail-abuse.org
Tue Feb 8 17:49:56 CET 2005
At 2:30 AM +0100 2005-02-08, Brad Knowles wrote:
> The latest crisis that has me wondering is the subject prefix stuff.
> Looking in NewsRunner.py, starting at line 104, we have:
>
> # Should we restore the original, non-prefixed subject for gatewayed
> # messages?
> origsubj = msgdata.get('origsubj')
> if not mlist.news_prefix_subject_too and origsubj is not None:
> del msg['subject']
> msg['subject'] = origsubj
Okay, I broke down and bought the three primary Python books --
Learning, Programming, and Nutshell. Looking at the string
functions, and not accounting for MIME encoding, Unicode encoding, or
subject numbering, to my naïeve perspective, it looks like we should
be able to turn this into something like the following:
# Should we restore the original, non-prefixed subject for gatewayed
# messages?
origsubj = msgdata.get('origsubj')
if not mlist.news_prefix_subject_too and origsubj is not None:
stripped_subj = subject.replace(r'\s*'+subject_prefix+r'\s*', ' ')
del msg['subject']
msg['subject'] = stripped_subj
The s.replace() function should grab any leading whitespace and
trailing whitespace surrounding the subject_prefix, and replace all
of that with a single space character.
Now, to go off and look at CookHeaders.py and see just how far off I am....
--
Brad Knowles, <brad at stop.mail-abuse.org>
"Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin (1706-1790), reply of the Pennsylvania
Assembly to the Governor, November 11, 1755
SAGE member since 1995. See <http://www.sage.org/> for more info.
More information about the Mailman-Developers
mailing list