Merge pull request #13271 from cpennington/dont-translate-passthrough
Don't use optparse's bad translation strings in passthrough_opts
This commit is contained in:
@@ -13,15 +13,6 @@ import paver.tasks
|
||||
from mock import patch
|
||||
|
||||
|
||||
try:
|
||||
from gettext import gettext
|
||||
except ImportError:
|
||||
def gettext(message):
|
||||
"""Dummy gettext"""
|
||||
return message
|
||||
_ = gettext
|
||||
|
||||
|
||||
class PassthroughOptionParser(OptionParser):
|
||||
"""
|
||||
An :class:`optparse.OptionParser` which captures any unknown options into
|
||||
@@ -66,9 +57,9 @@ class PassthroughOptionParser(OptionParser):
|
||||
|
||||
if len(rargs) < nargs:
|
||||
if nargs == 1:
|
||||
self.error(_("%s option requires an argument") % opt)
|
||||
self.error("%s option requires an argument" % opt)
|
||||
else:
|
||||
self.error(_("%s option requires %d arguments")
|
||||
self.error("%s option requires %d arguments"
|
||||
% (opt, nargs))
|
||||
elif nargs == 1:
|
||||
value = rargs.pop(0)
|
||||
@@ -77,7 +68,7 @@ class PassthroughOptionParser(OptionParser):
|
||||
del rargs[0:nargs]
|
||||
|
||||
elif had_explicit_value:
|
||||
self.error(_("%s option does not take a value") % opt)
|
||||
self.error("%s option does not take a value" % opt)
|
||||
|
||||
else:
|
||||
value = None
|
||||
@@ -111,9 +102,9 @@ class PassthroughOptionParser(OptionParser):
|
||||
nargs = option.nargs
|
||||
if len(rargs) < nargs:
|
||||
if nargs == 1:
|
||||
self.error(_("%s option requires an argument") % opt)
|
||||
self.error("%s option requires an argument" % opt)
|
||||
else:
|
||||
self.error(_("%s option requires %d arguments")
|
||||
self.error("%s option requires %d arguments"
|
||||
% (opt, nargs))
|
||||
|
||||
elif nargs == 1:
|
||||
|
||||
Reference in New Issue
Block a user