Search by unicode
This commit is contained in:
parent
e18e5222b7
commit
9540bc572c
4 changed files with 15 additions and 16 deletions
11
attributs.py
11
attributs.py
|
@ -238,7 +238,7 @@ class Attr(object):
|
|||
if unicode(self) in liste_exclue:
|
||||
return
|
||||
if self.unique:
|
||||
res = self.conn.search('%s=%s' % (attr, str(self)))
|
||||
res = self.conn.search(u'%s=%s' % (attr, str(self)))
|
||||
if res:
|
||||
raise UniquenessError("%s déjà existant" % attr, [r.dn for r in res])
|
||||
|
||||
|
@ -467,7 +467,7 @@ class mail(Attr):
|
|||
if res:
|
||||
raise ValueError("Le mail %s est déjà pris." % (str(self)))
|
||||
else:
|
||||
check = self.conn.search("mail=%s" % mail)
|
||||
check = self.conn.search(u'mail=%s' % mail)
|
||||
if len(check) >= 1:
|
||||
raise ValueError("Le mail %s est déjà pris." % (str(self)))
|
||||
|
||||
|
@ -639,7 +639,7 @@ class host(dnsAttr):
|
|||
if str(self) in liste_exclue:
|
||||
return
|
||||
if attr in ["host", "hostAlias"]:
|
||||
res = self.conn.search('(|(host=%s)(hostAlias=%s))' % ((str(self),)*2))
|
||||
res = self.conn.search(u'(|(host=%s)(hostAlias=%s))' % ((str(self),)*2))
|
||||
if res:
|
||||
raise ValueError("Hôte déjà existant", [r.dn for r in res])
|
||||
|
||||
|
@ -749,7 +749,6 @@ class rid(Attr):
|
|||
continue
|
||||
else:
|
||||
continue
|
||||
|
||||
self.value = rid
|
||||
|
||||
def __unicode__(self):
|
||||
|
@ -930,7 +929,7 @@ class responsable(Attr):
|
|||
return self._value
|
||||
else:
|
||||
try:
|
||||
res = self.conn.search('aid=%s' % self.__value)[0]
|
||||
res = self.conn.search(u'aid=%s' % self.__value)[0]
|
||||
except IndexError:
|
||||
raise ValueError("get_respo: L'adherent %s n'existe pas ou plus" % (self.__value))
|
||||
self._value = res
|
||||
|
@ -966,7 +965,7 @@ class imprimeurClub(Attr):
|
|||
return self._value
|
||||
else:
|
||||
try:
|
||||
res = self.conn.search('aid=%s' % int(self.__value))[0]
|
||||
res = self.conn.search(u'aid=%s' % int(self.__value))[0]
|
||||
except IndexError:
|
||||
raise ValueError("get_imprimeur: L'adhérent aid=%r n'existe pas ou plus" % self.__value)
|
||||
self._value = res
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue