umbrella lists and subject prefix (subject_prefix)
We are beginning to make use of Mailman here (good work!), and we are using it to provide company wide mailing lists. So, we have umbrella lists that distribute to other areas of the company in other parts of the world. So, a list like "listname@ourdomain.com" would be an umbrella for: "listname-us@ourdomain.com", "listname-uk@ourdomain.com", and so on. We've just started doing this, and myself and the administrator working on this quickly became annoyed that the subject lines ended up looking like: Subject: [listname-us] [listname] Test message
So, I modified MailList.py a bit so that it not only checks for subject_prefix in the subject, but also all of the acceptable_aliases for the list. So, now when a message is posted to listname, it gets resent to listname-*; while the subject remains as "Subject: [listname] Test message". The patch for this follows.
If anyone cares to now fix the little problem of the footer being added by both lists, I'd like to see the patch for that. Its a minor annoyance, but one I can live with for the time being. -Dan
-- Dan A. Dickey ddickey@wamnet.com
*** MailList.py.orig Tue Jul 20 21:19:21 1999 --- MailList.py Thu Sep 23 08:28:48 1999
*** 1130,1135 **** --- 1130,1157 ---- return 1 return 0
def HasPrefix(self, msg):
- """True if subject_prefix or any acceptable_alias is included in
the Subject: ."""
- subj = msg.getheader('subject')
# First check for our own subject_prefix:
- if re.search(re.escape(self.subject_prefix), subj, re.I):
return 1
# ... and only then try the regexp acceptable aliases.
for alias in string.split(self.acceptable_aliases, '\n'):
stripped = string.strip(alias)
try:
# The list alias in `stripped` is a user supplied regexp,
# which could be malformed.
if stripped and re.search(stripped, subj, re.I):
return 1
except re.error:
# `stripped' is a malformed regexp -- try matching
# safely, with all non-alphanumerics backslashed:
if stripped and re.search(re.escape(stripped), subj, re.I):
return 1
- return 0
"""Return a list of triples [(field name, regex, line), ...].""" # - Blank lines and lines with '#' as first char are skipped.def parse_matching_header_opt(self):
*** 1306,1313 **** prefix = self.subject_prefix if not subj: msg.SetHeader('Subject', '%s(no subject)' % prefix) ! elif prefix and not re.search(re.escape(self.subject_prefix), ! subj, re.I): msg.SetHeader('Subject', '%s%s' % (prefix, subj)) if self.anonymous_list: del msg['reply-to'] --- 1328,1334 ---- prefix = self.subject_prefix if not subj: msg.SetHeader('Subject', '%s(no subject)' % prefix) ! elif prefix and not self.HasPrefix(msg): msg.SetHeader('Subject', '%s%s' % (prefix, subj)) if self.anonymous_list: del msg['reply-to']
participants (2)
-
Dan A. Dickey
-
Sean Reifschneider