python3 exceptions

This commit is contained in:
François Poulain 2018-06-29 14:53:40 +02:00 committed by Frédéric Péters
parent 7b2f106348
commit 714bf8023b
1 changed files with 3 additions and 3 deletions

View File

@ -95,12 +95,12 @@ class Payment(PaymentCommon):
refdet = str(refdet)
if 6 > len(refdet) > 30:
raise ValueError('len(REFDET) < 6 or > 30')
except Exception, e:
except Exception as e:
raise ValueError('REFDET format invalide, %r' % refdet, e)
if objet is not None:
try:
objet = str(objet)
except Exception, e:
except Exception as e:
raise ValueError('OBJET must be a string', e)
if not objet.replace(' ','').isalnum():
raise ValueError('OBJECT must only contains '
@ -113,7 +113,7 @@ class Payment(PaymentCommon):
raise ValueError('no @ in MEL')
if not (6 <= len(mel) <= 80):
raise ValueError('len(MEL) is invalid, must be between 6 and 80')
except Exception, e:
except Exception as e:
raise ValueError('MEL is not a valid email, %r' % mel, e)
saisie = saisie or self.saisie