[lc_ldap] Corrections de bugs, et cohérence de code.
This commit is contained in:
parent
6d4d56db72
commit
7ed1874d62
4 changed files with 26 additions and 14 deletions
17
objets.py
17
objets.py
|
@ -108,6 +108,8 @@ class CransLdapObject(object):
|
|||
|
||||
attribs = []
|
||||
|
||||
ldap_name = "CransLdapObject"
|
||||
|
||||
def update_attribs(self):
|
||||
"""
|
||||
Fonction permettant de mettre à jours attribs, dès que les valeurs
|
||||
|
@ -225,6 +227,7 @@ class CransLdapObject(object):
|
|||
|
||||
def __ne__(self, obj):
|
||||
return not self == obj
|
||||
|
||||
def __eq__(self, obj):
|
||||
if isinstance(obj, self.__class__):
|
||||
if self.mode in ['w', 'rw']:
|
||||
|
@ -637,6 +640,14 @@ class CransLdapObject(object):
|
|||
out.append(u"%s : [%s] %s" % (date, author, u" ; ".join(mod_list)))
|
||||
return out
|
||||
|
||||
# On utilise carte_ok et paiement_ok dans blacklist_actif, qui sont définis dans les
|
||||
# objets enfants. On définit des méthodes vides ici pour la cohérence.
|
||||
def carte_ok(self):
|
||||
pass
|
||||
|
||||
def paiement_ok(self, no_bl=False):
|
||||
pass
|
||||
|
||||
def blacklist_actif(self, excepts=[]):
|
||||
"""Renvoie la liste des blacklistes actives sur l'entité
|
||||
Améliorations possibles:
|
||||
|
@ -862,11 +873,11 @@ class proprio(CransLdapObject):
|
|||
|
||||
def fin_adhesion(self):
|
||||
"""Retourne la date de fin d'adhésion"""
|
||||
return max([float(facture.get('finAdhesion', [crans_utils.fromGeneralizedTimeFormat(attributs.finAdhesion.default)])[0]) for facture in self.factures(refresh=True, mode="ro") if facture.get('controle', [''])[0] != u"FALSE" and facture.get('recuPaiement', [''])[0] != ''] + [0.0])
|
||||
return max([float(facture.get('finAdhesion', [crans_utils.from_generalized_time_format(attributs.finAdhesion.default)])[0]) for facture in self.factures(refresh=True, mode="ro") if facture.get('controle', [''])[0] != u"FALSE" and facture.get('recuPaiement', [''])[0] != ''] + [0.0])
|
||||
|
||||
def fin_connexion(self):
|
||||
"""Retourne la date de fin de connexion"""
|
||||
return max([float(facture.get('finConnexion', [crans_utils.fromGeneralizedTimeFormat(attributs.finConnexion.default)])[0]) for facture in self.factures(refresh=True, mode="ro") if facture.get('controle', [''])[0] != u"FALSE" and facture.get('recuPaiement', [''])[0] != ''] + [0.0])
|
||||
return max([float(facture.get('finConnexion', [crans_utils.from_generalized_time_format(attributs.finConnexion.default)])[0]) for facture in self.factures(refresh=True, mode="ro") if facture.get('controle', [''])[0] != u"FALSE" and facture.get('recuPaiement', [''])[0] != ''] + [0.0])
|
||||
|
||||
def paiement_ok(self, no_bl=False):
|
||||
u"""
|
||||
|
@ -1108,7 +1119,7 @@ class machine(CransLdapObject):
|
|||
self['ipHostNumber'] = []
|
||||
self['ip6HostNumber'] = []
|
||||
else:
|
||||
if unicode(self['ipHostNumber'][0]) != unicode(ip4_of_rid(sbm['rid'][1])):
|
||||
if unicode(self['ipHostNumber'][0]) != unicode(crans_utils.ip4_of_rid(sbm['rid'][1])):
|
||||
raise ValueError("L'ipv4 et le rid ne concordent pas !")
|
||||
self['ip6HostNumber'] = [unicode(crans_utils.ip6_of_mac(self['macAddress'][0].value, self['rid'][0].value))]
|
||||
if sbm['ipHostNumber']:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue