/usr/lib/python2.7/dist-packages/mailmanapi/utils.py is in mailman-api 0.2.9-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | import json
import logging
from time import strftime
from bottle import HTTPResponse
try:
from Mailman import MailList, Errors
except ImportError:
logging.error('Could not import Mailman module')
def parse_boolean(value):
if value and value.lower() == 'true':
return True
return False
def jsonify(body='', status=200):
response = HTTPResponse(content_type='application/json')
response.body = json.dumps(body)
response.status = status
return response
def get_mailinglist(listname, lock=True):
try:
return MailList.MailList(listname, lock=lock)
except Errors.MMUnknownListError:
raise jsonify("Unknown Mailing List `{}`.".format(listname), 404)
def get_timestamp():
return strftime('%a, %d %b %Y %H:%M:%S %z (%Z)')
|