Merge "Fix missing marker functions"

This commit is contained in:
Zuul 2018-01-27 12:01:45 +00:00 committed by Gerrit Code Review
commit 8316ade315
3 changed files with 7 additions and 5 deletions

View File

@ -89,8 +89,9 @@ def parse_version_string(version_string):
return Version(*(int(value) for value
in version_string.split('.', 1)))
except (ValueError, TypeError) as exc:
raise TypeError('invalid version string: %s; %s' % (
version_string, exc))
raise TypeError(
_('invalid version string: %(version_string)s; %(exc)s') %
{'version_string': version_string, 'exc': exc})
class MicroversionMiddleware(object):
@ -180,7 +181,7 @@ def extract_version(headers):
# version if we really need to.
if (str(request_version) in VERSIONS and request_version.matches()):
return request_version
raise ValueError('Unacceptable version header: %s' % version_string)
raise ValueError(_('Unacceptable version header: %s') % version_string)
# From twisted

View File

@ -32,6 +32,7 @@ from nova.compute import rpcapi as compute_rpcapi
from nova.compute import task_states
from nova.compute import vm_states
from nova import exception
from nova.i18n import _
from nova import objects
from nova.objects import base as obj_base
from nova import rpc
@ -110,7 +111,7 @@ class RPCClientCellsProxy(object):
version = kwargs.pop('version', None)
if kwargs:
raise ValueError("Unsupported kwargs: %s" % kwargs.keys())
raise ValueError(_("Unsupported kwargs: %s") % kwargs.keys())
if server:
ret._server = server

View File

@ -296,7 +296,7 @@ def last_completed_audit_period(unit=None, before=None):
else:
rightnow = timeutils.utcnow()
if unit not in ('month', 'day', 'year', 'hour'):
raise ValueError('Time period must be hour, day, month or year')
raise ValueError(_('Time period must be hour, day, month or year'))
if unit == 'month':
if offset == 0:
offset = 1