# HG changeset patch
# User Pascal Volk <user@localhost.localdomain.org>
# Date 1390858041 0
# Node ID 01db2457bbedc651033e9edd9552be52939a8d5b
# Parent  110491a871a74c0e20f66cecd97abf400397c630
VMM/handler: Improved domaininfo subcommand.

Check all labels for ASCII-compatible encoding, not only the first one.
If something is in ACE format, convert it to IDNA.

diff -r 110491a871a7 -r 01db2457bbed VirtualMailManager/handler.py
--- a/VirtualMailManager/handler.py	Sun Jan 26 16:13:00 2014 +0000
+++ b/VirtualMailManager/handler.py	Mon Jan 27 21:27:21 2014 +0000
@@ -522,7 +522,8 @@
                            INVALID_ARGUMENT)
         dom = self._get_domain(domainname)
         dominfo = dom.get_info()
-        if dominfo['domain name'].startswith('xn--'):
+        if dominfo['domain name'].startswith('xn--') or \
+           dominfo['domain name'].count('.xn--'):
             dominfo['domain name'] += ' (%s)' % \
                                       dominfo['domain name'].decode('idna')
         if details is None: