Converted except T,e expressions to except T as e

This commit is contained in:
Akita Noek
2016-06-27 13:14:36 -04:00
parent 7839db0c23
commit b57739a800
14 changed files with 37 additions and 37 deletions

View File

@@ -137,7 +137,7 @@ class BaseModel(models.Model):
errors = {}
try:
super(BaseModel, self).clean_fields(exclude)
except ValidationError, e:
except ValidationError as e:
errors = e.update_error_dict(errors)
for f in self._meta.fields:
if f.name in exclude:
@@ -145,7 +145,7 @@ class BaseModel(models.Model):
if hasattr(self, 'clean_%s' % f.name):
try:
setattr(self, f.name, getattr(self, 'clean_%s' % f.name)())
except ValidationError, e:
except ValidationError as e:
errors[f.name] = e.messages
if errors:
raise ValidationError(errors)

View File

@@ -701,7 +701,7 @@ class Job(UnifiedJob, JobOptions):
return
try:
extra_vars = json.loads(extra_data)
except Exception, e:
except Exception as e:
logger.warn("Exception deserializing extra vars: " + str(e))
evars = self.extra_vars_dict
evars.update(extra_vars)
@@ -1316,7 +1316,7 @@ class SystemJob(UnifiedJob, SystemJobOptions):
return
try:
extra_vars = json.loads(extra_data)
except Exception, e:
except Exception as e:
logger.warn("Exception deserializing extra vars: " + str(e))
evars = self.extra_vars_dict
evars.update(extra_vars)

View File

@@ -115,7 +115,7 @@ class ProjectOptions(models.Model):
try:
scm_url = update_scm_url(self.scm_type, scm_url,
check_special_cases=False)
except ValueError, e:
except ValueError as e:
raise ValidationError((e.args or ('Invalid SCM URL.',))[0])
scm_url_parts = urlparse.urlsplit(scm_url)
if self.scm_type and not any(scm_url_parts):
@@ -142,7 +142,7 @@ class ProjectOptions(models.Model):
try:
update_scm_url(self.scm_type, self.scm_url, scm_username,
scm_password)
except ValueError, e:
except ValueError as e:
raise ValidationError((e.args or ('Invalid credential.',))[0])
except ValueError:
pass