python3: catch exceptions using "as" syntax (#38094)
This commit is contained in:
parent
32af20ac95
commit
3900a8417c
|
@ -34,7 +34,7 @@ def synchronize_domino(publisher):
|
|||
users_by_code_interne[user.abelium_domino_code_famille] = user
|
||||
try:
|
||||
invoices = client.invoices
|
||||
except abelium_domino_ws.DominoException, e:
|
||||
except abelium_domino_ws.DominoException as e:
|
||||
publisher.notify_of_exception(sys.exc_info(), context='[DOMINO]')
|
||||
logger.error('domino cron: failure to retrieve invoice list from domino '
|
||||
'for synchronization [error:%s]', e)
|
||||
|
@ -136,7 +136,7 @@ def synchronize_domino(publisher):
|
|||
try:
|
||||
client.pay_invoice([invoice], invoice.montant, details,
|
||||
payment_invoice.paid_date)
|
||||
except abelium_domino_ws.DominoException, e:
|
||||
except abelium_domino_ws.DominoException as e:
|
||||
logger.error('domino cron: invoice %s has been paid, but the remote system '
|
||||
'is unreachable, notification will be done again '
|
||||
'later [error: %s]', invoice.id, e)
|
||||
|
|
|
@ -23,7 +23,7 @@ INVOICE_REGIE = 'invoice_regie'
|
|||
|
||||
try:
|
||||
import abelium_domino_ws
|
||||
except ImportError, e:
|
||||
except ImportError as e:
|
||||
abelium_domino_ws = None
|
||||
import_error = e
|
||||
|
||||
|
@ -86,7 +86,7 @@ class AbeliumDominoDirectory(Directory):
|
|||
try:
|
||||
from abelium_domino_synchro import synchronize_domino
|
||||
synchronize_domino(get_publisher())
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
r += htmltext('<pre>%s</pre>') % repr(e)
|
||||
r += htmltext('<p>code interne: %s</p>') % getattr(get_request().user, str('abelium_domino_code_famille'), None)
|
||||
r += htmltext('<dl>')
|
||||
|
|
|
@ -129,7 +129,7 @@ class AbeliumDominoRegisterFamilyWorkflowStatusItem(WorkflowStatusJumpItem):
|
|||
form_user = formdata.get_user()
|
||||
form_user.abelium_domino_code_famille = code_interne
|
||||
form_user.store()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if form.get_widget('family_id').parse():
|
||||
msg = _('Unable to update family: %s') % str(e)
|
||||
else:
|
||||
|
|
|
@ -430,7 +430,7 @@ class DominoWs(object):
|
|||
data = getattr(self.client.service, function_name)(self.domain, self.login, self.password, *args)
|
||||
self.logger.debug((u'result: %s' % data).encode('utf-8'))
|
||||
self.data = data
|
||||
except IOError, e:
|
||||
except IOError as e:
|
||||
raise DominoException('Erreur IO', e)
|
||||
if data is None:
|
||||
data = ''
|
||||
|
@ -607,7 +607,7 @@ class DominoWs(object):
|
|||
nom = ''
|
||||
d = { 'etablissement': nom, 'lignes': rows }
|
||||
invoice._detail = d
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
raise DominoException('Exception when retrieving invoice details', e)
|
||||
|
||||
def get_family_by_mail(self, email):
|
||||
|
|
|
@ -316,7 +316,7 @@ class RegieDirectory(Directory):
|
|||
if not infos['validation'](value):
|
||||
widget.set_error(_('Valeur invalide'))
|
||||
error = True
|
||||
except ValueError, e:
|
||||
except ValueError as e:
|
||||
widget.set_error(_(e.message))
|
||||
error = True
|
||||
if error:
|
||||
|
|
|
@ -320,7 +320,7 @@ class AlternateRootDirectory(OldRootDirectory):
|
|||
|
||||
try:
|
||||
return Directory._q_traverse(self, path)
|
||||
except errors.TraversalError, e:
|
||||
except errors.TraversalError as e:
|
||||
try:
|
||||
f = FormDef.get_by_urlname(path[0])
|
||||
except KeyError:
|
||||
|
|
Reference in New Issue