[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
15
attributs.py
15
attributs.py
|
@ -354,8 +354,8 @@ class mail(Attr):
|
||||||
if str(self) in liste_exclue:
|
if str(self) in liste_exclue:
|
||||||
return
|
return
|
||||||
if attr in ["mailAlias", "canonicalAlias", 'mail']:
|
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:
|
try:
|
||||||
smtp = smtplib.SMTP(smtpserv)
|
smtp = smtplib.SMTP(smtpserv)
|
||||||
smtp.putcmd("vrfy", mail)
|
smtp.putcmd("vrfy", mail)
|
||||||
|
@ -366,6 +366,10 @@ class mail(Attr):
|
||||||
|
|
||||||
if res:
|
if res:
|
||||||
raise ValueError("Le mail %s est déjà pris." % (str(self)))
|
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):
|
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):
|
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
|
optional = True
|
||||||
|
|
||||||
def parse_value(self, pos):
|
def parse_value(self, pos):
|
||||||
if pos == u'N/A N/A':
|
self.value = unicode(pos)
|
||||||
self.value = u"N/A N/A"
|
|
||||||
else:
|
|
||||||
lat, lon = pos.split(" ")
|
|
||||||
self.value = u"%f %f" % (float(lat), float(lon))
|
|
||||||
self.value = pos
|
|
||||||
|
|
||||||
class nvram(Attr):
|
class nvram(Attr):
|
||||||
legend = u"Configuration speciale"
|
legend = u"Configuration speciale"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue