Skip to content

Instantly share code, notes, and snippets.

@codyaray
Created May 31, 2011 14:45
Show Gist options
  • Save codyaray/1000619 to your computer and use it in GitHub Desktop.
Save codyaray/1000619 to your computer and use it in GitHub Desktop.
The authentication section of Mailman's private.py
# Authorization confirmed... output the desired file
try:
ctype = content_type(path)
if mboxfile:
f = open(os.path.join(mlist.archive_dir() + '.mbox',
mlist.internal_name() + '.mbox'))
ctype = 'text/plain'
elif true_filename[-3:] == '.gz':
import gzip
f = gzip.open(true_filename, 'r')
else:
f = open(true_filename, 'r')
except IOError:
msg = _('Private archive file not found')
doc.SetTitle(msg)
doc.AddItem(Header(2, msg))
print doc.Format()
syslog('error', 'Private archive file not found: %s', true_filename)
else:
print 'Content-type: %s\n' % ctype
sys.stdout.write(f.read())
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment