[Mailman-Users] mailman NameError: global name '_' is not defined

Steven Jones Steven.Jones at vuw.ac.nz
Wed Jun 8 05:07:45 CEST 2011


Hi,

thankyou for your time.

regards

Steven
________________________________________
From: Mark Sapiro [mark at msapiro.net]
Sent: Wednesday, 8 June 2011 2:53 p.m.
To: Steven Jones
Cc: mailman-users at python.org
Subject: Re: [Mailman-Users] mailman NameError: global name '_' is not defined

On 6/7/2011 6:35 PM, Steven Jones wrote:
> hi,
>
> Oops sorry think i copied the wrong one!


OK. See comments inline.


[...]
> import sys
> import getpass
> import getopt
>
> import paths
> from Mailman import Utils
> from Mailman.i18n import C_


It appears that Red Hat has implemented a  Mailman.i18n.C_ function that
is not in standard GNU Mailman and are using it here instead of the
standard Mailman.i18n._ function.

I can guess that C_ is intended to be 'command _', i.e. a replacement
for the standard i18n._() to be used in command line programs, but that
is only a guess, and I have no idea why they would do this.


> PROGRAM = sys.argv[0]
> ^L
> def usage(code, msg=''):
>     if code:
>         fd = sys.stderr
>     else:
>         fd = sys.stdout
>     print >> fd, _(__doc__)


However, in changing the references from _() to C_(), the line above was
overlooked. You can fix your issue by changing the single line above from

    print >> fd, _(__doc__)

to

    print >> fd, C_(__doc__)

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



More information about the Mailman-Users mailing list