summaryrefslogtreecommitdiff
path: root/Mailman/Cgi/private.py
diff options
context:
space:
mode:
authorbwarsaw2003-01-20 02:59:19 +0000
committerbwarsaw2003-01-20 02:59:19 +0000
commitdc80a0fee5e9dbdfeb63e55ca27036e781983c04 (patch)
tree3fc53a2d6aa820460f362652785d1331c4c7bda6 /Mailman/Cgi/private.py
parentcb051571464241022bec312d78d5b3da320c5f5b (diff)
downloadmailman-dc80a0fee5e9dbdfeb63e55ca27036e781983c04.tar.gz
mailman-dc80a0fee5e9dbdfeb63e55ca27036e781983c04.tar.zst
mailman-dc80a0fee5e9dbdfeb63e55ca27036e781983c04.zip
Diffstat (limited to 'Mailman/Cgi/private.py')
-rw-r--r--Mailman/Cgi/private.py23
1 files changed, 8 insertions, 15 deletions
diff --git a/Mailman/Cgi/private.py b/Mailman/Cgi/private.py
index 6b7af70ad..779fbec5c 100644
--- a/Mailman/Cgi/private.py
+++ b/Mailman/Cgi/private.py
@@ -1,25 +1,26 @@
-# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2003 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
+# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
"""Provide a password-interface wrapper around private archives.
"""
-import sys
import os
+import sys
import cgi
+import mimetypes
from Mailman import mm_cfg
from Mailman import Utils
@@ -43,14 +44,6 @@ def true_path(path):
return path[1:]
-def content_type(path):
- if path[-3:] == '.gz':
- path = path[:-3]
- if path[-4:] == '.txt':
- return 'text/plain'
- return 'text/html'
-
-
def main():
doc = Document()
@@ -140,12 +133,12 @@ def main():
# Authorization confirmed... output the desired file
try:
- ctype = content_type(path)
+ ctype, enc = mimetypes.guess_type(path, strict=0)
if mboxfile:
f = open(os.path.join(mlist.archive_dir() + '.mbox',
mlist.internal_name() + '.mbox'))
ctype = 'text/plain'
- elif true_filename[-3:] == '.gz':
+ elif true_filename.endswith('.gz'):
import gzip
f = gzip.open(true_filename, 'r')
else: