[attributs] Fonctions de test d'egalité des attributs
This commit is contained in:
parent
626851baca
commit
f5347106c7
1 changed files with 8 additions and 1 deletions
|
@ -287,9 +287,12 @@ class Attr(object):
|
|||
|
||||
def __ne__(self, obj):
|
||||
return not self == obj
|
||||
|
||||
def __eq__(self, item):
|
||||
if isinstance(item, self.__class__):
|
||||
return str(self) == str(item)
|
||||
elif isinstance(item, Attr) and item.python_type == self.python_type:
|
||||
return item.value == self.value
|
||||
elif self.python_type and isinstance(item, self.python_type):
|
||||
return self.value == item
|
||||
elif isinstance(item, str):
|
||||
|
@ -306,7 +309,10 @@ class Attr(object):
|
|||
return self.value.__cmp__(obj)
|
||||
|
||||
def __nonzero__(self):
|
||||
return self.value.__nonzero__()
|
||||
if self.value:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def parse_value(self, val):
|
||||
"""Transforme l'attribut pour travailler avec notre validateur
|
||||
|
@ -719,6 +725,7 @@ class solde(Attr):
|
|||
class dnsAttr(Attr):
|
||||
category = 'dns'
|
||||
ldap_name = "dnsAttr"
|
||||
python_type = unicode
|
||||
|
||||
def parse_value(self, val):
|
||||
val = val.lower()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue