# # Patch for Mailman to enable the magic identifiers in mailing list archives. # --- mailman-2.1.5-orig/Mailman/Defaults.py +++ mailman-2.1.5/Mailman/Defaults.py @@ -96,6 +96,11 @@ HOME_PAGE = 'index.html' MAILMAN_SITE_LIST = 'mailman' +# Integration with Bugzilla/SVN/Wiki +BUG_URL = """%s""" +VCS_URL = """%s""" +WIKI_URL = """%s""" + # Normally when a site administrator authenticates to a web page with the site # password, they get a cookie which authorizes them as the list admin. It # makes me nervous to hand out site auth cookies because if this cookie is --- mailman-2.1.5-orig/Mailman/Archiver/HyperArch.py +++ mailman-2.1.5/Mailman/Archiver/HyperArch.py @@ -154,6 +154,11 @@ # Argh! This pattern is buggy, and will choke on URLs with GET parameters. urlpat = re.compile(r'(\w+://[^>)\s]+)') # URLs in text +# Magic identifiers in text +bugpat = re.compile('(BugID:)\s?(\d+)', re.M) +vcspat = re.compile('(VCS:)\s?([0-9A-Za-z_/\-]*([.][0-9A-Za-z]*)*)', re.M) +wikipat = re.compile('(Wiki:)\s?([A-Za-z_\-:]*)', re.M) + # Blank lines blankpat = re.compile(r'^\s*$') @@ -1199,6 +1204,29 @@ source[i] = None dest[i] = L + # Add tags around the following texts + # "BugID: 1234" + # "VCS: dir/file.x" + # "Wiki: article" + + def __processbody_bug_link(self, m): + ref = m.group(1) + bug = m.group(2) + text = ref + " " + mm_cfg.BUG_URL % (bug, bug) + return text + + def __processbody_vcs_link(self, m): + ref = m.group(1) + vcs = m.group(2) + text = ref + " " + mm_cfg.VCS_URL % (vcs, vcs) + return text + + def __processbody_wiki_link(self, m): + ref = m.group(1) + wiki = m.group(2) + text = ref + " " + mm_cfg.WIKI_URL % (wiki, wiki) + return text + # Perform Hypermail-style processing of directives # in message bodies. Lines between and will be written # out precisely as they are; other lines will be passed to func2 @@ -1246,6 +1274,11 @@ s = lines[i] if s[0:1] in ' \t\n': lines[i] = '

' + s + # Linkify magic identifiers + for i in range(0, len(lines)): + lines[i] = re.sub(bugpat, self.__processbody_bug_link, lines[i]) + lines[i] = re.sub(vcspat, self.__processbody_vcs_link, lines[i]) + lines[i] = re.sub(wikipat, self.__processbody_wiki_link, lines[i]) article.html_body = lines return article