summaryrefslogtreecommitdiffstats
path: root/pykolab/cli
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-03-02 15:45:29 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-03-02 15:45:29 +0000
commit3334c2ed460ef138f1ed3a9f3e01c2cc6ab24531 (patch)
treed1574526d7ccda23dbcc122610398b199664eae5 /pykolab/cli
parent00d655a36452fd023062ae5cafe2080c46f79441 (diff)
downloadpykolab-3334c2ed460ef138f1ed3a9f3e01c2cc6ab24531.tar.gz
Convert command list-domains to using the wap client
Diffstat (limited to 'pykolab/cli')
-rw-r--r--pykolab/cli/cmd_list_domains.py25
1 files changed, 11 insertions, 14 deletions
diff --git a/pykolab/cli/cmd_list_domains.py b/pykolab/cli/cmd_list_domains.py
index 7a2bfd8..0bc2d27 100644
--- a/pykolab/cli/cmd_list_domains.py
+++ b/pykolab/cli/cmd_list_domains.py
@@ -22,33 +22,30 @@ import commands
import pykolab
from pykolab.translate import _
+from pykolab import wap_client
log = pykolab.getLogger('pykolab.cli')
conf = pykolab.getConf()
-auth = pykolab.auth
-imap = pykolab.imap
-
def __init__():
commands.register('list_domains', execute, description="List Kolab domains.")
def execute(*args, **kw):
- auth.connect()
-
# Create the authentication object.
# TODO: Binds with superuser credentials!
- domains = auth.list_domains()
+ wap_client.authenticate()
+ domains = wap_client.domains_list()
+
+ #print "domains:", domains['list']
print "%-39s %-40s" %("Primary Domain Name Space","Secondary Domain Name Space(s)")
# TODO: Take a hint in --quiet, and otherwise print out a nice table
# with headers and such.
- for domain,domain_aliases in domains:
- if len(domain_aliases) > 0:
- print _("%-39s %-40s") %(
- domain,
- ', '.join(domain_aliases)
- )
+ for domain_dn in domains['list'].keys():
+ if isinstance(domains['list'][domain_dn]['associateddomain'], list):
+ print domains['list'][domain_dn]['associateddomain'][0]
+ for domain_alias in domains['list'][domain_dn]['associateddomain'][1:]:
+ print "%-39s %-40s" %('', domain_alias)
else:
- print _("%-39s") %(domain)
-
+ print domains['list'][domain_dn]['associateddomain']