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, <[EMAIL PROTECTED]>

"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.
_______________________________________________
Mailman-Developers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Reply via email to