Improve Python 3.x compatibility

Some mechanical translation of the deprecated
except x,y construct. Should work with Python >= 2.6
just fine

Change-Id: I394f9956b9e3e3d9f5f1e9ad50c35b13200af2a1
This commit is contained in:
Dirk Mueller
2013-04-22 16:38:55 +02:00
parent 11c2c40d46
commit 45feb672af
9 changed files with 18 additions and 18 deletions
+1 -1
View File
@@ -207,7 +207,7 @@ class ImageManager(base.Manager):
obj_size = obj.tell()
obj.seek(0)
return obj_size
except IOError, e:
except IOError as e:
if e.errno == errno.ESPIPE:
# Illegal seek. This means the user is trying
# to pipe image data to the client, e.g.
+4 -4
View File
@@ -50,7 +50,7 @@ def get_image_filters_from_args(args):
"""Build a dictionary of query filters based on the supplied args."""
try:
fields = get_image_fields_from_args(args)
except RuntimeError, e:
except RuntimeError as e:
print e
return FAILURE
@@ -108,7 +108,7 @@ def do_add(gc, args):
"""DEPRECATED! Use image-create instead."""
try:
fields = get_image_fields_from_args(args.fields)
except RuntimeError, e:
except RuntimeError as e:
print e
return FAILURE
@@ -182,7 +182,7 @@ def do_update(gc, args):
"""DEPRECATED! Use image-update instead."""
try:
fields = get_image_fields_from_args(args.fields)
except RuntimeError, e:
except RuntimeError as e:
print e
return FAILURE
@@ -333,7 +333,7 @@ def do_clear(gc, args):
image.delete()
if args.verbose:
print 'done'
except Exception, e:
except Exception as e:
print 'Failed to delete image %s' % image.id
print e
return FAILURE
+1 -1
View File
@@ -309,7 +309,7 @@ def do_image_delete(gc, args):
if args.verbose:
print '[Done]'
except exc.HTTPException, e:
except exc.HTTPException as e:
if args.verbose:
print '[Fail]'
print '%s: Unable to delete image %s' % (e, args_image)