misc: update except syntax (#36515)

This commit is contained in:
Frédéric Péters 2019-11-12 08:54:00 +01:00
parent a17d189124
commit 87253343d4
4 changed files with 5 additions and 5 deletions

View File

@ -210,7 +210,7 @@ class CmdHoboNotify(Command):
users = User.get_users_with_name_identifier(uuid)
for user in users:
user.remove_self()
except Exception, e:
except Exception as e:
publisher.notify_of_exception(sys.exc_info(), context='[PROVISIONNING]')
CmdHoboNotify.register()

View File

@ -51,7 +51,7 @@ class Command(object):
sys.exit(1)
try:
self.config.read(base_options.configfile)
except ConfigParser.ParsingError, e:
except ConfigParser.ParsingError as e:
print >> sys.stderr, 'Invalid configuration file %s' % base_options.configfile
print >> sys.stderr, e
sys.exit(1)

View File

@ -385,7 +385,7 @@ class FCAuthMethod(AuthMethod):
try:
value = WorkflowStatusItem.compute(value, context=user_info)
except Exception, e:
except Exception as e:
get_publisher().notify_of_exception(sys.exc_info(), context='[FC-user-compute]')
continue
if field_varname == '__name':

View File

@ -109,7 +109,7 @@ class GeolocateWorkflowStatusItem(WorkflowStatusItem):
def geolocate_address_string(self, formdata):
try:
address = self.compute(self.address_string, raises=True)
except Exception, e:
except Exception as e:
get_logger().error('error in template for address string [%r]', e)
return
@ -149,7 +149,7 @@ class GeolocateWorkflowStatusItem(WorkflowStatusItem):
try:
lat, lon = str(value).split(';')
lat_lon = normalize_geolocation({'lon': lon, 'lat': lat})
except Exception, e:
except Exception as e:
get_logger().error('error geolocating from map variable [%r]', e)
return