[Mailman-Users] LogMsg problem

Todd Pfaff pfaff at edge.cis.mcmaster.ca
Fri Dec 3 16:52:47 CET 1999

On Fri, 3 Dec 1999, Barry A. Warsaw wrote:

>     TP> It seems that, in general, the use of LogMsg is inconsistent.
> You're right about that.  It would be a good thing to clean up the use
> of LogMsg.  I usually do the substitution before passing it to LogMsg,
> but some of the older code does it the other way.
>     TP> Any opinions about whether this is
>     TP> a good idea, whether it will work, or whether there is a
>     TP> better way to approach this problem?
>     |         try:
>     |             logf.write(msg % args + '\n')
>     |         except:
>     |             logf.write(msg + '\n')
> Just a point of Python style.  It's almost never appropriate to use a
> "bare" except like this because it can mask unexpected exceptions.  In
> this case using "except TypeError" would do the trick.

ok, thanks for the tip.

> This is probably okay as a stopgap, but it would be better to make the
> use of LogMsg more consistent.

it wouldn't be a big job.  there are only about 50 occurrences of LogMsg
calls in all files under the Mailman python directory, and of these, only
about 20 seem to have '%' substitution characters in the msg argument:

  cd ~mailman/Mailman
  grep LogMsg * | grep '%' | wc

the ones that pass an arg tuple would simply have to be changed so that
the ',' between the msg and args arguments is a '%' to do the
substitutions before the call.  then, remove the '%' substitution in

Todd Pfaff                         \  Email: pfaff at mcmaster.ca
Computing and Information Services  \ Voice: (905) 525-9140 x22920
ABB 132                              \  FAX: (905) 528-3773
McMaster University                   \
Hamilton, Ontario, Canada  L8S 4M1     \

More information about the Mailman-Users mailing list