[ I am not on the list so please leave me in the CC on this thread ]

After doing this 'patch' you can specify a single %d anywhere in
subject_prefix (ie the 'Prefix for subject line of list postings') and it
will be magically replaced to the post_id (ie the message index).

BTW, where is the post_id stored?  Can I updated it from the command line
with some (less)? standard tool?

I have tested with formats of type '[LIST (%d)]' for subject_prefix.
I would not be surprised if some strange formats may screw up my regular
expresions... today is my first day writing Python :)

Ex: Say you have a list with subject_prefix set to '[LIST (%d)]'
The first post will have a subject of:

        Subject: [LIST (1)] the real subject line

The reply to this will hold:

        Subject: Re: [LIST (2)] the real subject line

The reply to that will hold:

        Subject: Re: [LIST (3)] the real subject line

And so on.

Regards,
Bart.

-- 
        WebSig: http://www.jukie.net/~bart/sig/
--- CookHeaders.py-     Fri Apr 27 20:58:32 2001
+++ CookHeaders.py      Fri Apr 27 20:59:07 2001
@@ -47,13 +47,20 @@
         # such as the list admin).  We assume all digests have an appropriate
         # subject header added by the ToDigest module.
         prefix = mlist.subject_prefix
+        mprefix = re.escape(prefix)
+        if prefix and re.search(re.escape('%d'), prefix, re.I):
+            match = re.match(r"^(.*)"+re.escape("%d")+"(.*)$", prefix)
+            if match:
+                mprefix = re.escape(match.group(1))+"\d+"+re.escape(match.group$      
+      prefix = prefix % mlist.post_id
         # We purposefully leave no space b/w prefix and subject!
         if not subject:
-            del msg['subject']
-            msg['Subject'] = prefix + _('(no subject)')
-        elif prefix and not re.search(re.escape(prefix), subject, re.I):
-            del msg['subject']
-            msg['Subject'] = prefix + subject
+            msg['Subject'] = prefix + '(no subject)'
+        elif prefix:
+            match = re.match(r"^(.*)"+mprefix+"(.*)$", subject)
+            if match:
+                msg['Subject'] = match.group(1) + prefix + match.group(2)
+            else:
+                msg['Subject'] = prefix + subject
     #
     # get rid of duplicate headers
     del msg['sender']

Reply via email to