From d12ad982cde9266aed8430b2d46c45eada48fa6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Elliott=20B=C3=A9cue?= Date: Mon, 28 Jan 2013 22:47:19 +0100 Subject: [PATCH] =?UTF-8?q?=20*=20Quelques=20erreurs,=20maintenant=20?= =?UTF-8?q?=C3=A7a=20marche?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- attributs.py | 4 ++-- crans_utils.py | 3 +++ lc_ldap.py | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/attributs.py b/attributs.py index 9bf13c5..b0f1339 100644 --- a/attributs.py +++ b/attributs.py @@ -474,7 +474,7 @@ class ip6HostNumber(Attr): can_modify = [nounou] def parse_value(self, ip, ldif): - ip = ip6_of_mac(ldif['macAddress'][0], ldif['rid'][0]) + ip = ip6_of_mac(ldif['macAddress'][0], int(ldif['rid'][0])) self.value = netaddr.ip.IPAddress(ip) def __unicode__(self): @@ -506,7 +506,7 @@ class rid(Attr): # On veut éviter les rid qui recoupent les ipv4 finissant par # .0 ou .255 - plages = [xrange(rid[a][0], rid[a][1]+1) for a in rid.keys() if 'v6' not in a] + plages = [xrange(config.rid[a][0], config.rid[a][1]+1) for a in config.rid.keys() if 'v6' not in a] for plage in plages: if rid in plage: diff --git a/crans_utils.py b/crans_utils.py index 61d7fe0..922dc1b 100644 --- a/crans_utils.py +++ b/crans_utils.py @@ -60,6 +60,7 @@ def prefixev6_of_rid(rid): Cette fonction retourne l'ip de début de ce sous-réseau. """ + # Au cas où rid = int(rid) for net, plage in config.rid.items(): @@ -75,6 +76,8 @@ def ip6_of_mac(mac, rid): """ Retourne la bonne ipv6 de la machine en fonction de sa mac et de son rid. """ + # Au cas où + rid = int(rid) for net, plage in config.rid.items(): if rid >= plage[0] and rid <= plage[1]: diff --git a/lc_ldap.py b/lc_ldap.py index 28322a4..ee61b6f 100644 --- a/lc_ldap.py +++ b/lc_ldap.py @@ -325,7 +325,8 @@ class lc_ldap(ldap.ldapobject.LDAPObject): if i in nonfree: continue else: - my_id = attrify(i, attr, self, True) + # On crée l'attribut associé, pour parser sa valeur. + my_id = attrify(unicode(i), attr, {}, self, False) if my_id.value != i: continue else: