Remove string concatenation in favor of string formatting
Some of the modules still utilized string concatenation instead of using formatting. In order to align with other modules in the project, I refactored these modules to use string formatting instead. Change-Id: I708392e1d03b6331a134419aa0ae9dc02a05c31b Closes-Bug: 1522738
This commit is contained in:
committed by
Jean-Emile DARTOIS
parent
62570525ad
commit
1c49d07912
@@ -217,7 +217,7 @@ class JsonPatchType(wtypes.Base):
|
||||
|
||||
@staticmethod
|
||||
def validate(patch):
|
||||
_path = '/' + patch.path.split('/')[1]
|
||||
_path = '/{0}'.format(patch.path.split('/')[1])
|
||||
if _path in patch.internal_attrs():
|
||||
msg = _("'%s' is an internal attribute and can not be updated")
|
||||
raise wsme.exc.ClientSideError(msg % patch.path)
|
||||
|
||||
@@ -74,13 +74,13 @@ class ParsableErrorMiddleware(object):
|
||||
try:
|
||||
# simple check xml is valid
|
||||
body = [et.ElementTree.tostring(
|
||||
et.ElementTree.fromstring('<error_message>'
|
||||
+ '\n'.join(app_iter)
|
||||
+ '</error_message>'))]
|
||||
et.ElementTree.Element('error_message',
|
||||
text='\n'.join(app_iter)))]
|
||||
except et.ElementTree.ParseError as err:
|
||||
LOG.error(_LE('Error parsing HTTP response: %s'), err)
|
||||
body = ['<error_message>%s' % state['status_code']
|
||||
+ '</error_message>']
|
||||
body = [et.ElementTree.tostring(
|
||||
et.ElementTree.Element('error_message',
|
||||
text=state['status_code']))]
|
||||
state['headers'].append(('Content-Type', 'application/xml'))
|
||||
else:
|
||||
if six.PY3:
|
||||
|
||||
Reference in New Issue
Block a user