summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Mailman/Bouncer.py64
-rw-r--r--Mailman/ListAdmin.py12
-rw-r--r--Mailman/MailCommandHandler.py26
3 files changed, 49 insertions, 53 deletions
diff --git a/Mailman/Bouncer.py b/Mailman/Bouncer.py
index 918dd5572..f5cd1dea9 100644
--- a/Mailman/Bouncer.py
+++ b/Mailman/Bouncer.py
@@ -31,6 +31,8 @@ from Mailman import Errors
from Mailman import Utils
from Mailman import Message
from Mailman.Handlers import HandlerAPI
+from Mailman.Logging.Syslog import syslog
+
class Bouncer:
@@ -116,7 +118,7 @@ class Bouncer:
# No (or expired) priors - new record.
self.bounce_info[string.lower(email)] = [now, self.post_id,
self.post_id]
- self.LogMsg("bounce", report + "first")
+ syslog("bounce", report + "first")
dirty = 1
return
@@ -129,7 +131,7 @@ class Bouncer:
# There's been enough posts since last bounce that we're
# restarting. (Might should keep track of who goes stale
# how often.)
- self.LogMsg("bounce", report + "first fresh")
+ syslog("bounce", report + "first fresh")
self.bounce_info[addr] = [now, self.post_id, self.post_id]
dirty = 1
return
@@ -139,7 +141,7 @@ class Bouncer:
self.minimum_post_count_before_bounce_action)
and
(difference > self.minimum_removal_date * secs_per_day)):
- self.LogMsg("bounce", report + "exceeded limits")
+ syslog("bounce", report + "exceeded limits")
self.HandleBouncingAddress(addr, msg)
return
else:
@@ -149,27 +151,24 @@ class Bouncer:
post_count = 0
remain = (self.minimum_removal_date
* secs_per_day - difference)
- self.LogMsg("bounce",
- report + ("%d more allowed over %d secs"
- % (post_count, remain)))
+ syslog("bounce", report + ("%d more allowed over %d secs"
+ % (post_count, remain)))
return
elif len(Utils.FindMatchingAddresses(addr, self.digest_members)):
if self.volume > hist[1]:
- self.LogMsg("bounce",
- "%s: first fresh (D)", self._internal_name)
+ syslog("bounce", "%s: first fresh (D)" %
+ self._internal_name)
self.bounce_info[addr] = [now, self.volume, self.volume]
return
if difference > self.minimum_removal_date * secs_per_day:
- self.LogMsg("bounce", report + "exceeded limits (D)")
+ syslog("bounce", report + "exceeded limits (D)")
self.HandleBouncingAddress(addr, msg)
return
- self.LogMsg("bounce", report + "digester lucked out")
+ syslog("bounce", report + "digester lucked out")
else:
- self.LogMsg("bounce",
- "%s: address %s not a member.",
- self._internal_name,
- addr)
+ syslog("bounce", "%s: address %s not a member." %
+ (self.internal_name(), addr))
finally:
if dirty and saveifdirty:
self.Save()
@@ -202,12 +201,12 @@ class Bouncer:
# Whoops! This is a bounce of a bounce notice - do not
# perpetuate the bounce loop! Log it prominently and be
# satisfied with that.
- self.LogMsg("error",
- "%s: Bounce recipient loop"
- " encountered!\n\t%s\n\tBad admin recipient: %s",
- self._internal_name,
- "(Ie, bounce notification addr, itself, bounces.)",
- addr)
+ syslog("error",
+ "%s: Bounce recipient loop"
+ " encountered!\n\t%s\n\tBad admin recipient: %s" %
+ (self.internal_name(),
+ "(Ie, bounce notification addr, itself, bounces.)",
+ addr))
return
import mimetools
boundary = mimetools.choose_boundary()
@@ -267,24 +266,23 @@ class Bouncer:
Returning success and notification status."""
if not self.IsMember(addr):
reason = "User not found."
- self.LogMsg("bounce", "%s: NOT disabled %s: %s",
- self.real_name, addr, reason)
+ syslog("bounce", "%s: NOT disabled %s: %s" %
+ (self.real_name, addr, reason))
return reason, 1
try:
if self.GetUserOption(addr, mm_cfg.DisableDelivery):
# No need to send out notification if they're already disabled.
- self.LogMsg("bounce",
- "%s: already disabled %s", self.real_name, addr)
+ syslog("bounce", "%s: already disabled %s" %
+ (self.real_name, addr))
return 1, 0
else:
self.SetUserOption(addr, mm_cfg.DisableDelivery, 1)
- self.LogMsg("bounce",
- "%s: disabled %s", self.real_name, addr)
+ syslog("bounce", "%s: disabled %s" % (self.real_name, addr))
self.Save()
return 1, 1
except Errors.MMNoSuchUserError:
- self.LogMsg("bounce", "%s: NOT disabled %s: %s",
- self.real_name, addr, Errors.MMNoSuchUserError)
+ syslog("bounce", "%s: NOT disabled %s: %s" %
+ (self.real_name, addr, Errors.MMNoSuchUserError))
self.ClearBounceInfo(addr)
self.Save()
return Errors.MMNoSuchUserError, 1
@@ -295,17 +293,17 @@ class Bouncer:
Returning success and notification status."""
if not self.IsMember(addr):
reason = "User not found."
- self.LogMsg("bounce", "%s: NOT removed %s: %s",
- self.real_name, addr, reason)
+ syslog("bounce", "%s: NOT removed %s: %s" %
+ (self.real_name, addr, reason))
return reason, 1
try:
self.DeleteMember(addr, "bouncing addr")
- self.LogMsg("bounce", "%s: removed %s", self.real_name, addr)
+ syslog("bounce", "%s: removed %s" % (self.real_name, addr))
self.Save()
return 1, 1
except Errors.MMNoSuchUserError:
- self.LogMsg("bounce", "%s: NOT removed %s: %s",
- self.real_name, addr, Errors.MMNoSuchUserError)
+ syslog("bounce", "%s: NOT removed %s: %s" %
+ (self.real_name, addr, Errors.MMNoSuchUserError))
self.ClearBounceInfo(addr)
self.Save()
return Errors.MMNoSuchUserError, 1
diff --git a/Mailman/ListAdmin.py b/Mailman/ListAdmin.py
index dda35a2c0..7cdb7a435 100644
--- a/Mailman/ListAdmin.py
+++ b/Mailman/ListAdmin.py
@@ -34,8 +34,9 @@ from Mailman import Message
from Mailman import mm_cfg
from Mailman import Utils
from Mailman import Errors
-from Mailman.pythonlib.StringIO import StringIO
from Mailman.Handlers import HandlerAPI
+from Mailman.Logging.Syslog import syslog
+from Mailman.pythonlib.StringIO import StringIO
# Request types requiring admin approval
HELDMSG = 1
@@ -182,8 +183,7 @@ class ListAdmin:
# Queue the file for delivery by qrunner. Trying to deliver the
# message directly here can lead to a huge delay in web
# turnaround.
- self.LogMsg('vette', 'approved held message enqueued: %s' %
- filename)
+ syslog('vette', 'approved held message enqueued: %s' % filename)
msg.Enqueue(self, newdata=msgdata)
elif value == 1:
# Rejected
@@ -210,7 +210,7 @@ class ListAdmin:
}
if comment:
note = note + '\n\tReason: ' + strquote(comment)
- self.LogMsg('vette', note)
+ syslog('vette', note)
# always unlink the file containing the message text. It's not
# necessary anymore, regardless of the disposition of the message.
try:
@@ -243,8 +243,8 @@ class ListAdmin:
#
# TBD: this really shouldn't go here but I'm not sure where else is
# appropriate.
- self.LogMsg('vette', '%s: held subscription request from %s' %
- (self.real_name, addr))
+ syslog('vette', '%s: held subscription request from %s' %
+ (self.real_name, addr))
# possibly notify the administrator
if self.admin_immed_notify:
subject = 'New subscription request to list %s from %s' % (
diff --git a/Mailman/MailCommandHandler.py b/Mailman/MailCommandHandler.py
index 8e2e92c28..83e4d3113 100644
--- a/Mailman/MailCommandHandler.py
+++ b/Mailman/MailCommandHandler.py
@@ -30,8 +30,9 @@ from Mailman import Message
from Mailman import Errors
from Mailman import mm_cfg
from Mailman import Utils
-from Mailman.pythonlib.StringIO import StringIO
from Mailman.Handlers import HandlerAPI
+from Mailman.Logging.Syslog import syslog
+from Mailman.pythonlib.StringIO import StringIO
@@ -136,15 +137,12 @@ class MailCommandHandler:
# This is for what are probably delivery-failure notices of
# subscription confirmations that are, of necessity, bounced
# back to the -request address.
- self.LogMsg("bounce",
- ("%s: Mailcmd rejected"
- "\n\tReason: Probable bounced subscribe-confirmation"
- "\n\tFrom: %s"
- "\n\tSubject: %s"
- ),
- self._internal_name,
- msg.getheader('from'),
- subject)
+ syslog("bounce", "%s: Mailcmd rejected"
+ "\n\tReason: Probable bounced subscribe-confirmation"
+ "\n\tFrom: %s"
+ "\n\tSubject: %s" % (self.internal_name(),
+ msg.getheader('from'),
+ subject))
return
if subject:
subject = string.strip(subject)
@@ -239,8 +237,8 @@ list administrator automatically.''' % admin)
self.AddError(errmsg, trunc=0)
self.AddToResponse('\n' + tbmsg, trunc=0)
# log it to the error file
- self.LogMsg('error',
- 'Unexpected Mailman error:\n%s' % tbmsg)
+ syslog('error',
+ 'Unexpected Mailman error:\n%s' % tbmsg)
# and send the traceback to the user
responsemsg = Message.UserNotification(
admin, admin, 'Unexpected Mailman error',
@@ -528,8 +526,8 @@ background and instructions for subscribing to and using it, visit:
self.AddError("You gave the wrong password.")
except Errors.MMBadUserError:
self.AddError('Your stored password is bogus.')
- self.LogMsg('subscribe', 'User %s on list %s has no password' %
- (addr, self.internal_name()))
+ syslog('subscribe', 'User %s on list %s has no password' %
+ (addr, self.internal_name()))
def ProcessSubscribeCmd(self, args, cmd, mail):
"""Parse subscription request and send confirmation request."""