[Mailman-Developers] error with bad email with % in addErrorin htmlformat.py

Mark Sapiro msapiro at value.net
Tue Jan 11 23:58:53 CET 2005


Brad Knowles wrote:

>At 9:39 AM +0100 2005-01-11, Brad Knowles wrote:
>
>>  	There needs to be another way to solve this problem.
>
>	I got a private reply with an alternative solution to this 
>problem.  With permission, I am including it here:
>
>Subject: RE: [Mailman-Developers] error with bad email with % in 
>addErrorin	htmlformat.py
>Date: Tue, 11 Jan 2005 10:10:07 -0500
>From: "Mike Sandler" <msandler at HostMySite.com>
>To: "Brad Knowles" <brad at stop.mail-abuse.org>
>
>I believe that it is a probably a good idea to fix the htmlformat.py
>addError to accept empty args. I have never programmed python before - I
>hacked a solution.
>
>I was the one that was afflicted with the problem.  I "fixed" the
>problem by changing htmlformat.py around line 340 to:
>     def addError(self, errmsg, tag=None, *args):
>         if tag is None:
>             tag = _('Error: ')
>         if args is not ():
>            self.AddItem(Header(3, Bold(FontAttr(
>                _(tag), color=mm_cfg.WEB_ERROR_COLOR,
>size='+2')).Format() +
>                             Italic(errmsg % args ).Format()))
>         else:
>                 self.AddItem(Header(3, Bold(FontAttr(
>                         _(tag), color=mm_cfg.WEB_ERROR_COLOR,
>size='+2')).Format() +
>                             Italic(errmsg).Format()))

Yes, Mike Sandler first raised this issue on the Mailman-users list and
he and I had an off list exchange about it leading to my submitting
the bug report.

I know Mike thinks his solution is appropriate for him and is satisfied
with it, but it is really more of an avoidance of the 'We're sorry, we
hit a bug!' response than it is a solution to the problem. Actually,
the 'We're sorry, we hit a bug!' response is appropriate in this case
because there is a problem with args which causes the exception. args
is always supposed to contain appropriate values for the string
replacements in errmsg, and the real solution to this is to understand
why it is empty or whatever in this pathological case and to fix that
underlying problem, not to avoid the exception by issuing a "half
baked" error message with unreplaced string specifiers which would
just make it that much more difficult to find the source of the
problem should it occur again.

Tokio's last post in this thread seemed to indicate he has a handle on
the cause and presumably the cure.

--
Mark Sapiro <msapiro at value.net>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan



More information about the Mailman-Developers mailing list