[Mailman-Developers] Fix for bug 170, is it any good?
Todd Pfaff
pfaff@edge.cis.mcmaster.ca
Tue, 18 Apr 2000 17:45:02 -0400 (EDT)
i think i ran into a similar problem with LogMsg() and my workaround was
to modify LogMsg to handle exceptions so that i didn't have to change code
anywhere else. it's not a perfect solution, but at least it stops LogMsg
from complaining.
try this modified version of LogMsg from mailman-1.1/MailMan/MailList.py:
def LogMsg(self, kind, msg, *args):
"""Append a message to the log file for messages of specified kind."""
# For want of a better fallback, we use sys.stderr if we can't get
# a log file. We need a better way to warn of failed log access...
if self._log_files.has_key(kind):
logf = self._log_files[kind]
else:
logf = self._log_files[kind] = StampedLogger(kind)
try:
logf.write(msg % args + '\n')
except:
logf.write(msg + '\n')
logf.flush()
On Tue, 18 Apr 2000, David Caldwell wrote:
> In ListAdmin.py this line (line 167 in 1.1, line 200 in 2.0beta2):
>
> self.LogMsg("vette", note)
>
> seems to be causing Mailman trouble. Above that you create 'note' and
> use strquote to remove percents from variables you catenate to it.
> But you don't use strquote on everything. In 2.0beta2 you added
> strquote to the subject line, but the sender still doesn't have it
> (unless I missed something). Instead of trying to catch all the
> percents in the strings you catenate, could you just change the line
> to this:
>
> self.LogMsg("vette", '%s', note)
>
> and get rid of the whole problem in one fell swoop? It seems more
> straight forward to me. But then I don't know python that well. I
> picked up enough to try to fix this problem I'm having where a % in
> the senders address on a moderated list bombs the list software. My
> change seems to work, but I'm not sure if there are any ramifications.
--
Todd Pfaff \ Email: pfaff@mcmaster.ca
Computing and Information Services \ Voice: (905) 525-9140 x22920
ABB 132 \ FAX: (905) 528-3773
McMaster University \
Hamilton, Ontario, Canada L8S 4M1 \