From f7bc95a871abd6af6bfec062feefe851c1ad2a4e Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Wed, 4 Sep 2013 14:40:46 +0200 Subject: [PATCH] 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 --- designateclient/cli/base.py | 2 +- designateclient/warlock.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/designateclient/cli/base.py b/designateclient/cli/base.py index c9e46dd..824865d 100644 --- a/designateclient/cli/base.py +++ b/designateclient/cli/base.py @@ -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] diff --git a/designateclient/warlock.py b/designateclient/warlock.py index fd9c4b8..073fe47 100644 --- a/designateclient/warlock.py +++ b/designateclient/warlock.py @@ -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)