Changeset - 8e2ff6443761
[Not reviewed]
default
0 1 0
Dennis Fink - 10 years ago 2014-12-13 14:46:12
dennis.fink@c3l.lu
Fix ipv6 support
1 file changed with 5 insertions and 5 deletions:
0 comments (0 inline, 0 general)
ennstatus/api/functions.py
Show inline comments
 
@@ -63,7 +63,7 @@ def check_json_format(server):
 

	
 
            if any([address.is_private, address.is_multicast,
 
                    address.is_unspecified, address.is_reserved,
 
                    address.is_loopback, address.link_local]):
 
                    address.is_loopback]):
 
                raise ValueError('ip is not accepted!\n')
 

	
 
        except ipaddress.AddressValueError:
 
@@ -74,11 +74,11 @@ def check_json_format(server):
 
            address = ipaddress.IPv6Address(server['ip6'])
 
            if any([address.is_private, address.is_multicast,
 
                    address.is_unspecified, address.is_reserved,
 
                    address.is_loopback, address.link_local]):
 
                raise ValueError('ip is not accepted!\n')
 
                    address.is_loopback]):
 
                raise ValueError('ip6 is not accepted!\n')
 

	
 
        except ipaddress.AddressValueError:
 
            raise ValueError('ip is not the right format!\n')
 
            raise ValueError('ip6 is not the right format!\n')
 

	
 
    return True
 

	
 
@@ -98,7 +98,7 @@ def update_server(server, ip):
 

	
 
    if ip.version == 4:
 
        server['country'] = gi4.country_name_by_addr(str(ip))
 
    elif ip.verion == 6:
 
    elif ip.version == 6:
 
        server['country'] = gi6.country_name_by_addr(str(ip))
 

	
 
    server_name = server['server_name']
0 comments (0 inline, 0 general)