diff --git a/gestion/iptools.py b/gestion/iptools.py index b6698e34..5acba0c5 100755 --- a/gestion/iptools.py +++ b/gestion/iptools.py @@ -50,6 +50,8 @@ def DecToQuad(ip_dec) : except : raise ValueError('IP Invalide') +__paramDone = {} + def param(net, raw=False) : """ net est un résau fourni sous la forme xxx.xxx.xxx.xxx/yy @@ -62,6 +64,8 @@ def param(net, raw=False) : Si raw = False, alors, on ne convertit pas les résultats sous forme pointée. Ils restent sous forme d'un entier. """ + if raw and net in __paramDone: + return __paramDone[net] reseau = {} ip, mask = net.split('/') @@ -82,6 +86,8 @@ def param(net, raw=False) : if not raw: for i in reseau.keys(): reseau[i] = DecToQuad(reseau[i]) + else: + __paramDone[net] = reseau return reseau def AddrInNet(ip,net) :