From d5379bbdfccf965652b70edcb592ec2142810cb6 Mon Sep 17 00:00:00 2001 From: Nicolas Dandrimont Date: Sun, 14 Sep 2008 04:28:02 +0200 Subject: [PATCH] sre est deprecated en Python2.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... et re est complètement équivalent à sre en Python2.4 darcs-hash:20080914022802-ffbb2-45c348e8db5f09a1bb37d78b5b77beef1bbe3821.gz --- gestion/ldap_crans.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gestion/ldap_crans.py b/gestion/ldap_crans.py index fd552d2f..28a7c477 100755 --- a/gestion/ldap_crans.py +++ b/gestion/ldap_crans.py @@ -10,7 +10,7 @@ Licence : GPLv2 """ from socket import gethostname -import smtplib, sre, os, random, string, time, sys, pwd +import smtplib, re, os, random, string, time, sys, pwd import ldap, ldap.modlist, ldap_passwd import config, annuaires, iptools, chgpass, cPickle, config_mail @@ -1392,7 +1392,7 @@ class BaseProprietaire(BaseClasseCrans): def validate(alias): alias = alias.lower() - if not sre.match(r"^[a-z0-9](\.?[-a-z0-9]+)*$", alias): + if not re.match(r"^[a-z0-9](\.?[-a-z0-9]+)*$", alias): raise ValueError("Alias incorrect : %s" % alias) if "." not in alias: alias += ".perso.crans.org" @@ -1514,7 +1514,7 @@ class BaseProprietaire(BaseClasseCrans): if new == None: return actuel - if not sre.match(r'^[+-][pck]$', new): + if not re.match(r'^[+-][pck]$', new): raise ValueError('modification de controle incorrecte') for c in 'pck': @@ -1956,7 +1956,7 @@ class Adherent(BaseProprietaire): raise ValueError(u"Caractère interdits dans l'adresse mail (%s)." % l) # Pour les vicieux - if sre.match('.*crans.(org|ens-cachan.fr)$', new): + if re.match('.*crans.(org|ens-cachan.fr)$', new): raise ValueError(u"Adresse mail @crans interdite ici") # Il ne doit pas y avoir de compte @@ -2465,9 +2465,9 @@ class Club(BaseProprietaire): # Génération du login : club- login = login.lower() - if not sre.match('^club-', login): + if not login.startswith('club-'): login = 'club-' + login - if not sre.match('^[a-z0-9]*[a-z]+[a-z0-9-]*$', login): + if not re.match('^[a-z0-9]*[a-z]+[a-z0-9-]*$', login): raise ValueError(u'Login incorrect') login = preattr(login)[1] @@ -2720,7 +2720,7 @@ class Machine(BaseClasseCrans): self._data.pop('prise') return - if not sre.match('^[a-cg-jmp][0-6][0-5][0-9]$', new.lower()): + if not re.match('^[a-cg-jmp][0-6][0-5][0-9]$', new.lower()): raise ValueError('Prise incorrecte') self._set('prise', [new.upper()])