sre est deprecated en Python2.5
... et re est complètement équivalent à sre en Python2.4 darcs-hash:20080914022802-ffbb2-45c348e8db5f09a1bb37d78b5b77beef1bbe3821.gz
This commit is contained in:
parent
8cadc47bcc
commit
d5379bbdfc
1 changed files with 7 additions and 7 deletions
|
@ -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 fourni>
|
||||
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()])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue