VirtualMailManager/VirtualMailManager.py
changeset 143 16542519a5a8
parent 140 ffac064bd728
child 155 eb866ebb9f2e
--- a/VirtualMailManager/VirtualMailManager.py	Fri Sep 04 20:27:39 2009 +0000
+++ b/VirtualMailManager/VirtualMailManager.py	Sat Sep 05 18:01:04 2009 +0000
@@ -122,29 +122,20 @@
     def idn2ascii(domainname):
         """Converts an idn domainname in punycode.
 
-        Keyword arguments:
-        domainname -- the domainname to convert (str)
+        Arguments:
+        domainname -- the domainname to convert (unicode)
         """
-        tmp = []
-        for label in domainname.split('.'):
-            if len(label) == 0:
-                continue
-            tmp.append(ToASCII(label))
-        return '.'.join(tmp)
+        return '.'.join([ToASCII(lbl) for lbl in domainname.split('.') if lbl])
     idn2ascii = staticmethod(idn2ascii)
 
     def ace2idna(domainname):
         """Convertis a domainname from ACE according to IDNA
 
-        Keyword arguments:
+        Arguments:
         domainname -- the domainname to convert (str)
         """
-        tmp = []
-        for label in domainname.split('.'):
-            if len(label) == 0:
-                continue
-            tmp.append(ToUnicode(label))
-        return '.'.join(tmp)
+        return u'.'.join([ToUnicode(lbl) for lbl in domainname.split('.')\
+                if lbl])
     ace2idna = staticmethod(ace2idna)
 
     def chkDomainname(domainname):