Skip to content

Commit

Permalink
2.1.7 vhost patch applied
Browse files Browse the repository at this point in the history
  • Loading branch information
msapiro committed Jan 28, 2010
1 parent 708b7a2 commit 1fb1df5
Show file tree
Hide file tree
Showing 39 changed files with 1,016 additions and 133 deletions.
29 changes: 23 additions & 6 deletions Mailman/Archiver/Archiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import os
import errno
import traceback
import re
from cStringIO import StringIO

Expand All @@ -46,6 +45,17 @@

def makelink(old, new):
try:
# Before symlinking, make sure that the directory where the
# symlink will be created exists.
omask = os.umask(0)
try:
try:
os.makedirs(os.path.split(new)[0], 02775)
except OSError, e:
if e.errno <> errno.EEXIST:
raise
finally:
os.umask(omask)
os.symlink(old, new)
except OSError, e:
if e.errno <> errno.EEXIST:
Expand Down Expand Up @@ -80,9 +90,17 @@ def InitVars(self):
# listname.mbox
# listname/
# lots-of-pipermail-stuff
# domain.com/
# listname.mbox/
# listname.mbox
# listname/
# lots-of-pipermail-stuff
# public/
# listname.mbox@ -> ../private/listname.mbox
# listname@ -> ../private/listname
# domain.com/
# listname.mbox@ -> ../../private/listname.mbox
# listname@ -> ../../private/listname
#
# IOW, the mbox and pipermail archives are always stored in the
# private archive for the list. This is safe because archives/private
Expand All @@ -93,15 +111,15 @@ def InitVars(self):
omask = os.umask(0)
try:
try:
os.mkdir(self.archive_dir()+'.mbox', 02775)
os.makedirs(self.archive_dir()+'.mbox', 02775)
except OSError, e:
if e.errno <> errno.EEXIST: raise
# We also create an empty pipermail archive directory into
# which we'll drop an empty index.html file into. This is so
# that lists that have not yet received a posting have
# /something/ as their index.html, and don't just get a 404.
try:
os.mkdir(self.archive_dir(), 02775)
os.makedirs(self.archive_dir(), 02775)
except OSError, e:
if e.errno <> errno.EEXIST: raise
# See if there's an index.html file there already and if not,
Expand Down Expand Up @@ -132,8 +150,7 @@ def archive_dir(self):

def ArchiveFileName(self):
"""The mbox name where messages are left for archive construction."""
return os.path.join(self.archive_dir() + '.mbox',
self.internal_name() + '.mbox')
return Site.get_mboxpath(self.internal_name())

def GetBaseArchiveURL(self):
url = self.GetScriptURL('private', absolute=1) + '/'
Expand All @@ -143,7 +160,7 @@ def GetBaseArchiveURL(self):
hostname = re.match('[^:]*://([^/]*)/.*', url).group(1)\
or mm_cfg.DEFAULT_URL_HOST
url = mm_cfg.PUBLIC_ARCHIVE_URL % {
'listname': self.internal_name(),
'listname': self.local_part,
'hostname': hostname
}
if not url.endswith('/'):
Expand Down
20 changes: 13 additions & 7 deletions Mailman/Archiver/HyperArch.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
from Mailman.SafeDict import SafeDict
from Mailman.Logging.Syslog import syslog
from Mailman.Mailbox import ArchiverMailbox
from Mailman import Site

# Set up i18n. Assume the current language has already been set in the caller.
_ = i18n._
Expand Down Expand Up @@ -569,16 +570,21 @@ def as_text(self):
if d['_message_id']:
headers.append('Message-ID: %(_message_id)s')
body = EMPTYSTRING.join(self.body)
if isinstance(body, types.UnicodeType):
body = body.encode(Utils.GetCharSet(self._lang), 'replace')
cset = Utils.GetCharSet(self._lang)
# Coerce the body to Unicode and replace any invalid characters.
if not isinstance(body, types.UnicodeType):
body = unicode(body, cset, 'replace')
if mm_cfg.ARCHIVER_OBSCURES_EMAILADDRS:
otrans = i18n.get_translation()
try:
atmark = unicode(_(' at '), cset)
i18n.set_language(self._lang)
body = re.sub(r'([-+,.\w]+)@([-+.\w]+)',
'\g<1>' + _(' at ') + '\g<2>', body)
'\g<1>' + atmark + '\g<2>', body)
finally:
i18n.set_translation(otrans)
# Return body to character set of article.
body = body.encode(cset, 'replace')
return NL.join(headers) % d + '\n\n' + body + '\n'

def _set_date(self, message):
Expand Down Expand Up @@ -748,11 +754,11 @@ def quotetime(s):

def html_TOC(self):
mlist = self.maillist
listname = mlist.internal_name()
mbox = os.path.join(mlist.archive_dir()+'.mbox', listname+'.mbox')
local_part = mlist.local_part
mbox = Site.get_mboxpath(mlist.internal_name())
d = {"listname": mlist.real_name,
"listinfo": mlist.GetScriptURL('listinfo', absolute=1),
"fullarch": '../%s.mbox/%s.mbox' % (listname, listname),
"fullarch": '../%s.mbox/%s.mbox' % (local_part, local_part), # NDIM XXX Path
"size": sizeof(mbox, mlist.preferred_language),
'meta': '',
}
Expand Down Expand Up @@ -830,7 +836,7 @@ def GetArchLock(self):
return 1
self._lock_file = LockFile.LockFile(
os.path.join(mm_cfg.LOCK_DIR,
self.maillist.internal_name() + '-arch.lock'))
self.maillist.internal_name() + '-arch.lock')) # NDIM XXX Lock
try:
self._lock_file.lock(timeout=0.5)
except LockFile.TimeOutError:
Expand Down
9 changes: 7 additions & 2 deletions Mailman/Bouncers/SimpleMatch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 1998-2003 by the Free Software Foundation, Inc.
# Copyright (C) 1998-2006 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
Expand All @@ -12,7 +12,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.

"""Recognizes simple heuristically delimited bounces."""

Expand Down Expand Up @@ -74,6 +75,10 @@ def _c(pattern):
(_c('This message was created automatically by mail delivery'),
_c('^---- START OF RETURNED MESSAGE ----'),
_c("addressed to '(?P<addr>[^']*)'")),
# Prodigy.net full mailbox
(_c("User's mailbox is full:"),
_c('Unable to deliver mail.'),
_c("User's mailbox is full:\s*<(?P<addr>.*)>.*$")),
# Next one goes here...
]

Expand Down
5 changes: 3 additions & 2 deletions Mailman/Cgi/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ def main():
# None, so just do the admin overview and be done with it
admin_overview()
return

# Get the list object
listname = parts[0].lower()
listname = Utils.GetListName(parts)
try:
mlist = MailList.MailList(listname, lock=0)
except Errors.MMListError, e:
Expand Down Expand Up @@ -418,7 +419,7 @@ def show_results(mlist, doc, category, subcat, cgidata):
'<br>&nbsp;<br>')
# We do not allow through-the-web deletion of the site list!
if mm_cfg.OWNERS_CAN_DELETE_THEIR_OWN_LISTS and \
mlist.internal_name() <> mm_cfg.MAILMAN_SITE_LIST:
mlist.local_name <> mm_cfg.MAILMAN_SITE_LIST:
otherlinks.AddItem(Link(mlist.GetScriptURL('rmlist'),
_('Delete this mailing list')).Format() +
_(' (requires confirmation)<br>&nbsp;<br>'))
Expand Down
2 changes: 1 addition & 1 deletion Mailman/Cgi/admindb.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def main():
handle_no_list()
return

listname = parts[0].lower()
listname = Utils.GetListName(parts)
try:
mlist = MailList.MailList(listname, lock=0)
except Errors.MMListError, e:
Expand Down
2 changes: 1 addition & 1 deletion Mailman/Cgi/confirm.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def main():
print doc.Format()
return

listname = parts[0].lower()
listname = Utils.GetListName(parts)
try:
mlist = MailList.MailList(listname, lock=0)
except Errors.MMListError, e:
Expand Down
5 changes: 3 additions & 2 deletions Mailman/Cgi/edithtml.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 1998-2005 by the Free Software Foundation, Inc.
# Copyright (C) 1998-2006 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
Expand All @@ -20,6 +20,7 @@
import os
import cgi
import errno
import re

from Mailman import Utils
from Mailman import MailList
Expand Down Expand Up @@ -60,7 +61,7 @@ def _(s):
print doc.Format()
return

listname = parts[0].lower()
listname = Utils.GetListName(parts)
try:
mlist = MailList.MailList(listname, lock=0)
except Errors.MMListError, e:
Expand Down
2 changes: 1 addition & 1 deletion Mailman/Cgi/listinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def main():
listinfo_overview()
return

listname = parts[0].lower()
listname = Utils.GetListName(parts)
try:
mlist = MailList.MailList(listname, lock=0)
except Errors.MMListError, e:
Expand Down
2 changes: 1 addition & 1 deletion Mailman/Cgi/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def main():
return

# get the list and user's name
listname = parts[0].lower()
listname = Utils.GetListName(parts)
# open list
try:
mlist = MailList.MailList(listname, lock=0)
Expand Down
6 changes: 3 additions & 3 deletions Mailman/Cgi/private.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from Mailman import i18n
from Mailman.htmlformat import *
from Mailman.Logging.Syslog import syslog
from Mailman.Site import get_mboxpath

# Set up i18n. Until we know which list is being requested, we use the
# server's default.
Expand Down Expand Up @@ -79,7 +80,7 @@ def main():
true_filename = os.path.join(
mm_cfg.PRIVATE_ARCHIVE_FILE_DIR, tpath)

listname = parts[0].lower()
listname = parts[0].lower() # NDIM XXX use Utils.GetListname
mboxfile = ''
if len(parts) > 1:
mboxfile = parts[1]
Expand Down Expand Up @@ -166,8 +167,7 @@ def main():
if ctype is None:
ctype = 'text/html'
if mboxfile:
f = open(os.path.join(mlist.archive_dir() + '.mbox',
mlist.internal_name() + '.mbox'))
f = open(get_mboxpath(mlist.internal_name()))
ctype = 'text/plain'
elif true_filename.endswith('.gz'):
import gzip
Expand Down
5 changes: 3 additions & 2 deletions Mailman/Cgi/rmlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def main():
syslog('error', 'Bad URL specification: %s', parts)
return

listname = parts[0].lower()
listname = Utils.GetListName(parts)
try:
mlist = MailList.MailList(listname, lock=0)
except Errors.MMListError, e:
Expand Down Expand Up @@ -136,8 +136,9 @@ def process_request(doc, cgidata, mlist):

problems = 0
listname = mlist.internal_name()
local_part = mlist.local_part
for dirtmpl in REMOVABLES:
dir = os.path.join(mm_cfg.VAR_PREFIX, dirtmpl % listname)
dir = os.path.join(mm_cfg.VAR_PREFIX, dirtmpl % local_part) # NDIM XXX
if os.path.islink(dir):
try:
os.unlink(dir)
Expand Down
2 changes: 1 addition & 1 deletion Mailman/Cgi/roster.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def main():
error_page(_('Invalid options to CGI script'))
return

listname = parts[0].lower()
listname = Utils.GetListName(parts)
try:
mlist = MailList.MailList(listname, lock=0)
except Errors.MMListError, e:
Expand Down
2 changes: 1 addition & 1 deletion Mailman/Cgi/subscribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def main():
print doc.Format()
return

listname = parts[0].lower()
listname = Utils.GetListName(parts)
try:
mlist = MailList.MailList(listname, lock=0)
except Errors.MMListError, e:
Expand Down
2 changes: 1 addition & 1 deletion Mailman/Defaults.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ DEFAULT_MSG_HEADER = ""
DEFAULT_MSG_FOOTER = """_______________________________________________
%(real_name)s mailing list
%(real_name)s@%(host_name)s
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
%(web_page_url)slistinfo%(cgiext)s/%(local_part)s
"""

# Where to put subject prefix for 'Re:' messages:
Expand Down
5 changes: 2 additions & 3 deletions Mailman/Deliverer.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,8 @@ def SendHostileSubscriptionNotice(self, listname, address):
# Some one was invited to one list but tried to confirm to a different
# list. We inform both list owners of the bogosity, but be careful
# not to reveal too much information.
selfname = self.internal_name()
syslog('mischief', '%s was invited to %s but confirmed to %s',
address, listname, selfname)
address, listname, self.internal_name())
# First send a notice to the attacked list
msg = Message.OwnerNotification(
self,
Expand Down Expand Up @@ -207,7 +206,7 @@ def sendProbe(self, member, msg):
# probe message.
token = self.pend_new(Pending.PROBE_BOUNCE, member, msg)
probedict = {
'bounces': self.internal_name() + '-bounces',
'bounces': self.getListAddress('bounces'),
'token': token,
}
probeaddr = '%s@%s' % ((mm_cfg.VERP_PROBE_FORMAT % probedict),
Expand Down
3 changes: 2 additions & 1 deletion Mailman/Gui/Digest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@

# Common b/w nondigest and digest headers & footers. Personalizations may add
# to this.
# NDIM XXX remove _internal_name?
ALLOWEDS = ('real_name', 'list_name', 'host_name', 'web_page_url',
'description', 'info', 'cgiext', '_internal_name',
'description', 'info', 'cgiext', '_internal_name', 'local_part',
)


Expand Down
2 changes: 1 addition & 1 deletion Mailman/Gui/General.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def GetConfigInfo(self, mlist, category, subcat):

def _setValue(self, mlist, property, val, doc):
if property == 'real_name' and \
val.lower() <> mlist.internal_name().lower():
val.lower() <> mlist.real_name.lower():
# These values can't differ by other than case
doc.addError(_("""<b>real_name</b> attribute not
changed! It must differ from the list's name by case
Expand Down
3 changes: 3 additions & 0 deletions Mailman/Gui/Topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ def GetConfigInfo(self, mlist, category, subcat=None):
]

def handleForm(self, mlist, category, subcat, cgidata, doc):
# MAS: Did we come from the authentication page?
if not cgidata.has_key('topic_box_01'):
return
topics = []
# We start i at 1 and keep going until we no longer find items keyed
# with the marked tags.
Expand Down
3 changes: 2 additions & 1 deletion Mailman/HTMLFormatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,8 @@ def GetStandardReplacements(self, lang=None):
d = {
'<mm-mailman-footer>' : self.GetMailmanFooter(),
'<mm-list-name>' : self.real_name,
'<mm-email-user>' : self._internal_name,
'<mm-email-user>' : self.local_part,
'<mm-complete-name>' : self.internal_name(),
'<mm-list-description>' : self.description,
'<mm-list-info>' : BR.join(self.info.split(NL)),
'<mm-form-end>' : self.FormatFormEnd(),
Expand Down
Loading

0 comments on commit 1fb1df5

Please sign in to comment.