VMM/network: Post-2to3 fix. s/addr.encode('hex')/b2a_hex(addr). v0.7.x
authorPascal Volk <user@localhost.localdomain.org>
Sat, 05 Jan 2013 18:23:05 +0000
branchv0.7.x
changeset 672 d3fd9bb0a5ea
parent 671 a9d86ccac044
child 673 de046a3b29a5
VMM/network: Post-2to3 fix. s/addr.encode('hex')/b2a_hex(addr).
VirtualMailManager/network.py
--- a/VirtualMailManager/network.py	Sun Dec 30 18:13:56 2012 +0000
+++ b/VirtualMailManager/network.py	Sat Jan 05 18:23:05 2013 +0000
@@ -10,6 +10,8 @@
 
 import socket
 
+from binascii import b2a_hex
+
 
 class NetInfo(object):
     """Simple class for CIDR network addresses an IP addresses."""
@@ -97,4 +99,4 @@
             address = socket.inet_pton(family, ip_address)
         except socket.error:
             raise ValueError('Not a valid IPv6 address: %r' % ip_address)
-    return (family, int(address.encode('hex'), 16))
+    return (family, int(b2a_hex(address), 16))