[attributs] Les mails ne sont pas tous en @crans.*
This commit is contained in:
parent
89a43cc49a
commit
7c2db3dc98
1 changed files with 16 additions and 17 deletions
33
attributs.py
33
attributs.py
|
@ -354,18 +354,22 @@ class mail(Attr):
|
|||
if str(self) in liste_exclue:
|
||||
return
|
||||
if attr in ["mailAlias", "canonicalAlias", 'mail']:
|
||||
mail = str(self).split('@', 1)[0]
|
||||
mail, end = str(self).split('@', 1)[0], str(self).split("@", 1)[1]
|
||||
if end.startswith('crans'):
|
||||
try:
|
||||
smtp = smtplib.SMTP(smtpserv)
|
||||
smtp.putcmd("vrfy", mail)
|
||||
res = smtp.getreply()[0] in [250, 252]
|
||||
smtp.close()
|
||||
except:
|
||||
raise ValueError(u'Serveur de mail injoignable')
|
||||
|
||||
try:
|
||||
smtp = smtplib.SMTP(smtpserv)
|
||||
smtp.putcmd("vrfy", mail)
|
||||
res = smtp.getreply()[0] in [250, 252]
|
||||
smtp.close()
|
||||
except:
|
||||
raise ValueError(u'Serveur de mail injoignable')
|
||||
|
||||
if res:
|
||||
raise ValueError("Le mail %s est déjà pris." % (str(self)))
|
||||
if res:
|
||||
raise ValueError("Le mail %s est déjà pris." % (str(self)))
|
||||
else:
|
||||
check = self.conn.search("mail=%s" % mail)
|
||||
if len(check) >= 1:
|
||||
raise ValueError("Le mail %s est déjà pris." % (str(self)))
|
||||
|
||||
def parse_value(self, mail):
|
||||
if not re.match('^[-_.0-9A-Za-z]+@([A-Za-z0-9]{1}[A-Za-z0-9-_]+[.])+[a-z]{2,6}$', mail):
|
||||
|
@ -671,12 +675,7 @@ class positionBorne(Attr):
|
|||
optional = True
|
||||
|
||||
def parse_value(self, pos):
|
||||
if pos == u'N/A N/A':
|
||||
self.value = u"N/A N/A"
|
||||
else:
|
||||
lat, lon = pos.split(" ")
|
||||
self.value = u"%f %f" % (float(lat), float(lon))
|
||||
self.value = pos
|
||||
self.value = unicode(pos)
|
||||
|
||||
class nvram(Attr):
|
||||
legend = u"Configuration speciale"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue