summaryrefslogtreecommitdiff
path: root/cgi/archives
diff options
context:
space:
mode:
authormailman1998-02-27 15:59:51 +0000
committermailman1998-02-27 15:59:51 +0000
commit34424e63e8008c267dd7eeaf15c6453e246ec966 (patch)
tree8aa35d6f084fdece3420bbad78db9a77fc39848d /cgi/archives
parent63788a9f869ff411dd93d0336d0f939b4a41c542 (diff)
downloadmailman-34424e63e8008c267dd7eeaf15c6453e246ec966.tar.gz
mailman-34424e63e8008c267dd7eeaf15c6453e246ec966.tar.zst
mailman-34424e63e8008c267dd7eeaf15c6453e246ec966.zip
Initial revision
Diffstat (limited to 'cgi/archives')
-rwxr-xr-xcgi/archives67
1 files changed, 67 insertions, 0 deletions
diff --git a/cgi/archives b/cgi/archives
new file mode 100755
index 000000000..c5614e7d5
--- /dev/null
+++ b/cgi/archives
@@ -0,0 +1,67 @@
+#!/usr/local/bin/python
+# We don't need to lock in this script, because we're never going to change data.
+
+import sys, os, types, posix
+sys.stderr = sys.stdout
+sys.path.append('/home/mailman/mailman/modules')
+import mm_utils, maillist, htmlformat
+
+print "Content-type: text/html"
+print
+
+path = os.environ['PATH_INFO']
+list_info = mm_utils.GetPathPieces(path)
+
+if len(list_info) < 1:
+ print "<h2>Invalid options to CGI script.</h2>"
+ sys.exit(0)
+
+list_name = list_info[0]
+
+try:
+ list = maillist.MailList(list_name)
+except:
+ print "<h2>%s: No such list.</h2>" % list_name
+ sys.exit(0)
+
+if not list._ready:
+ print "<h2>%s: No such list.</h2>" % list_name
+ sys.exit(0)
+
+def GetArchiveList(list):
+ archive_list = htmlformat.UnorderedList()
+
+ def ArchiveFilter(str):
+ if str[:7] <> 'volume_':
+ return 0
+ try:
+ x = eval(str[7:])
+ if type(x) <> types.IntType:
+ return 0
+ if x < 1:
+ return 0
+ return 1
+ except:
+ return 0
+ try:
+ dir_listing = filter(ArchiveFilter, os.listdir(list.archive_directory))
+ except posix.error:
+ return "<h3><em>No archives are currently available.</em></h3>"
+ if not len(dir_listing):
+ return "<h3><em>No archives are currently available.</em></h3>"
+ for dir in dir_listing:
+ link = htmlformat.Link(os.path.join(list._base_archive_url, dir),
+ "Volume %s" % dir[7:])
+ archive_list.AddItem(link)
+
+ return archive_list.Format()
+
+
+
+
+replacements = list.GetStandardReplacements()
+replacements['<mm-archive-list>'] = GetArchiveList(list)
+
+# Just doing print list.ParseTags(...) calls ParseTags twice???
+text = list.ParseTags('archives.html', replacements)
+print text