From 1aedddb0314488cbe6acf3c0da64c4b3feb82d7e Mon Sep 17 00:00:00 2001 From: bernat Date: Fri, 15 Jul 2005 20:31:19 +0200 Subject: [PATCH] Acceleration... darcs-hash:20050715183119-d1718-ec0be153ee0b38e8786d5c1edeea11063a21e598.gz --- gestion/iptools.py | 6 ++++++ 1 file changed, 6 insertions(+) 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) :