Exception: message need '_' function

eventlet_backdoor.py
    loopingcall.py
    service.py

Change-Id: I41bf13a2c6afddbffe30ff36134c4a42eaa2ccf1
This commit is contained in:
zwei 2016-03-09 11:27:33 +08:00
parent 6a56ec63bf
commit 9b82953871
3 changed files with 10 additions and 10 deletions

View File

@ -28,7 +28,7 @@ import traceback
import eventlet.backdoor
import greenlet
from oslo_service._i18n import _LI
from oslo_service._i18n import _LI, _
from oslo_service import _options
@ -37,8 +37,8 @@ LOG = logging.getLogger(__name__)
class EventletBackdoorConfigValueError(Exception):
def __init__(self, port_range, help_msg, ex):
msg = ('Invalid backdoor_port configuration %(range)s: %(ex)s. '
'%(help)s' %
msg = (_('Invalid backdoor_port configuration %(range)s: %(ex)s. '
'%(help)s') %
{'range': port_range, 'ex': ex, 'help': help_msg})
super(EventletBackdoorConfigValueError, self).__init__(msg)
self.port_range = port_range
@ -220,7 +220,7 @@ def _main():
where_running_thread = _initialize_if_enabled(conf)
if not where_running_thread:
raise RuntimeError("Did not create backdoor at requested location")
raise RuntimeError(_("Did not create backdoor at requested location"))
else:
_where_running, thread = where_running_thread
thread.wait()

View File

@ -263,9 +263,9 @@ class BackOffLoopingCall(LoopingCallBase):
"""
_RNG = random.SystemRandom()
_KIND = 'Dynamic backoff interval looping call'
_RUN_ONLY_ONE_MESSAGE = ("A dynamic backoff interval looping call can"
" only run one function at a time")
_KIND = _('Dynamic backoff interval looping call')
_RUN_ONLY_ONE_MESSAGE = _("A dynamic backoff interval looping call can"
" only run one function at a time")
def __init__(self, f=None, *args, **kw):
super(BackOffLoopingCall, self).__init__(f=f, *args, **kw)

View File

@ -35,7 +35,7 @@ from eventlet import event
from oslo_concurrency import lockutils
from oslo_service import eventlet_backdoor
from oslo_service._i18n import _LE, _LI, _LW
from oslo_service._i18n import _LE, _LI, _LW, _
from oslo_service import _options
from oslo_service import systemd
from oslo_service import threadgroup
@ -81,7 +81,7 @@ def _is_sighup_and_daemon(signo):
def _check_service_base(service):
if not isinstance(service, ServiceBase):
raise TypeError("Service %(service)s must an instance of %(base)s!"
raise TypeError(_("Service %(service)s must an instance of %(base)s!")
% {'service': service, 'base': ServiceBase})
@ -696,7 +696,7 @@ def launch(conf, service, workers=1):
"""
if workers is not None and workers <= 0:
raise ValueError("Number of workers should be positive!")
raise ValueError(_("Number of workers should be positive!"))
if workers is None or workers == 1:
launcher = ServiceLauncher(conf)