Use Python 3.x compatible except construct.
Python 3.x deprecated the form "except x,y:". Switch usage to "except x as y:", which works with any Python version >= 2.6 Change-Id: Id276fdaee9e8753568227e638408e5bccff28e67
This commit is contained in:
parent
bd8023493a
commit
f7bc95a871
@ -47,7 +47,7 @@ class Command(CliffCommand):
|
||||
|
||||
try:
|
||||
return super(Command, self).run(parsed_args)
|
||||
except exceptions.RemoteError, e:
|
||||
except exceptions.RemoteError as e:
|
||||
columns = ['Code', 'Type']
|
||||
values = [e.code, e.type]
|
||||
|
||||
|
@ -41,7 +41,7 @@ def model_factory(schema):
|
||||
"""Apply a JSON schema to an object"""
|
||||
try:
|
||||
jsonschema.validate(obj, schema, cls=jsonschema.Draft3Validator)
|
||||
except jsonschema.ValidationError, e:
|
||||
except jsonschema.ValidationError as e:
|
||||
raise ValidationError(str(e))
|
||||
|
||||
class Model(dict):
|
||||
@ -54,7 +54,7 @@ def model_factory(schema):
|
||||
self.__dict__['validator'] = validator
|
||||
try:
|
||||
self.validator(d)
|
||||
except ValidationError, e:
|
||||
except ValidationError as e:
|
||||
raise ValueError('Validation Error: %s' % str(e))
|
||||
else:
|
||||
dict.__init__(self, d)
|
||||
@ -72,7 +72,7 @@ def model_factory(schema):
|
||||
mutation[key] = value
|
||||
try:
|
||||
self.validator(mutation)
|
||||
except ValidationError, e:
|
||||
except ValidationError as e:
|
||||
raise InvalidOperation(str(e))
|
||||
|
||||
dict.__setitem__(self, key, value)
|
||||
@ -105,7 +105,7 @@ def model_factory(schema):
|
||||
mutation.update(other)
|
||||
try:
|
||||
self.validator(mutation)
|
||||
except ValidationError, e:
|
||||
except ValidationError as e:
|
||||
raise InvalidOperation(str(e))
|
||||
dict.update(self, other)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user