Added support for ipv4 in formataddr
authorJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Sun, 27 Jun 2010 10:42:42 +0000 (10:42 +0000)
committerJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Sun, 27 Jun 2010 10:42:42 +0000 (10:42 +0000)
bin/ntools.py

index 5e5b8df7eb42633ef3c52dafb4e2dbc1cd2f7cf9..1233b7bde22bc2b26a3e89b6cf9b64e3c0c9fc3e 100644 (file)
@@ -101,11 +101,12 @@ def str_split_column_ipv6(txt):
 
 
 def formataddr(addr):
-    # FIXME: don't do that if address is IPv4
     if addr.startswith(IPV4_IN_IPV6_PREFIX):
         return addr[7:]
-    else:
+    elif ':' in addr:
         return '['+addr+']'
+    else:
+        return addr
 
 
 #if __name__ == '__main__':