Fix and enable gating on H702

Formatting operations should be outside of localization,
otherwise translation lookup will never find a translated
string as a match. This also fixes H701 alongway.

Change-Id: I6708e0f5b11841b18ba9042ac4958643f91396dd
This commit is contained in:
Dirk Mueller 2013-12-11 22:09:28 +01:00
parent 63ab7f0ae6
commit 2fb875f79f
5 changed files with 24 additions and 26 deletions

View File

@ -673,9 +673,9 @@ class Controller(controller.BaseController):
image_size_store != image_size_meta):
msg = _("Provided image size must match the stored "
"image size. (provided size: %(ps)d, "
"stored size: %(ss)d)" %
{"ps": image_size_meta,
"ss": image_size_store})
"stored size: %(ss)d)") % {
"ps": image_size_meta,
"ss": image_size_store}
LOG.debug(msg)
raise HTTPConflict(explanation=msg,
request=req,

View File

@ -76,9 +76,10 @@ class PropertyRules(object):
raise exception.InvalidPropertyProtectionConfiguration()
if self.prop_prot_rule_format not in ['policies', 'roles']:
msg = _("Invalid value '%s' for 'property_protection_rule_format'"
". The permitted values are 'roles' and 'policies'" %
self.prop_prot_rule_format)
msg = _("Invalid value '%s' for "
"'property_protection_rule_format'. "
"The permitted values are "
"'roles' and 'policies'") % self.prop_prot_rule_format
LOG.error(msg)
raise exception.InvalidPropertyProtectionConfiguration()
@ -93,11 +94,11 @@ class PropertyRules(object):
if permissions:
if self.prop_prot_rule_format == 'policies':
if ',' in permissions:
msg = _("Multiple policies '%s' not allowed for a"
" given operation. Policies can be "
"combined in the policy file" %
permissions)
LOG.error(msg)
LOG.error(
_("Multiple policies '%s' not allowed"
"for a given operation. Policies can be "
"combined in the policy file"),
permissions)
raise exception.\
InvalidPropertyProtectionConfiguration()
self.prop_exp_mapping[compiled_rule] = property_exp
@ -110,11 +111,10 @@ class PropertyRules(object):
property_dict[operation] = permissions
else:
property_dict[operation] = []
msg = _(('Property protection on operation %s for rule '
'%s is not found. No role will be allowed to '
'perform this operation.' %
(operation, property_exp)))
LOG.warn(msg)
LOG.warn(
_('Property protection on operation %s for rule '
'%s is not found. No role will be allowed to '
'perform this operation.'), operation, property_exp)
self.rules.append((compiled_rule, property_dict))
@ -165,9 +165,9 @@ class PropertyRules(object):
rule_roles = rule.get(action)
if rule_roles:
if '@' in rule_roles and '!' in rule_roles:
msg = _("Malformed property protection rule '%s': '@' "
"and '!' are mutually exclusive"
% property_name)
msg = _(
"Malformed property protection rule '%s': '@' "
"and '!' are mutually exclusive") % property_name
LOG.error(msg)
raise webob.exc.HTTPInternalServerError(msg)
elif '@' in rule_roles:

View File

@ -244,9 +244,9 @@ class ImageMemberRepo(object):
pass
else:
msg = _('The target member %(member_id)s is already '
'associated with image %(image_id)s.' %
dict(member_id=image_member.member_id,
image_id=self.image.image_id))
'associated with image %(image_id)s.') % {
'member_id': image_member.member_id,
'image_id': self.image.image_id}
raise exception.Duplicate(msg)
image_member_values = self._format_image_member_to_db(image_member)

View File

@ -286,7 +286,7 @@ class BaseStore(glance.store.base.Store):
resp_chunk_size=self.CHUNKSIZE)
except swiftclient.ClientException as e:
if e.http_status == httplib.NOT_FOUND:
msg = _("Swift could not find object %s." % location.obj)
msg = _("Swift could not find object %s.") % location.obj
LOG.warn(msg)
raise exception.NotFound(msg)
else:

View File

@ -44,9 +44,7 @@ commands = {posargs}
# H306 imports not in alphabetical order
# H402 one line docstring needs punctuation.
# H404 multi line docstring should start with a summary
# H701 Empty localisation string
# H702 Formatting operation should be outside of localization
# H703 multiple positional placeholders
ignore = E125,E126,E711,E712,F811,F821,F841,H102,H201,H202,H233,H301,H302,H306,H402,H404,H701,H702,H703
ignore = E125,E126,E711,E712,F811,F821,F841,H102,H201,H202,H233,H301,H302,H306,H402,H404,H703
builtins = _
exclude = .venv,.git,.tox,dist,doc,etc,*glance/locale*,*openstack/common*,*lib/python*,*egg,build