VirtualMailManager/VirtualMailManager.py
changeset 90 1734eb5101c6
parent 88 b3debcfea7bc
child 94 0d303d15549e
--- a/VirtualMailManager/VirtualMailManager.py	Thu Sep 18 18:40:54 2008 +0000
+++ b/VirtualMailManager/VirtualMailManager.py	Sun Oct 05 03:33:38 2008 +0000
@@ -503,8 +503,8 @@
     def domainInfo(self, domainname, details=None):
         if details not in [None, 'accounts', 'aliasdomains', 'aliases', 'full',
                 'relocated', 'detailed']:
-            raise VMMDomainException(_(u'Invalid argument: »%s«') % details,
-                ERR.INVALID_OPTION)
+            raise VMMException(_(u'Invalid argument: »%s«') % details,
+                    ERR.INVALID_AGUMENT)
         if details == 'detailed':
             details = 'full'
             warning = _(u"""\
@@ -516,8 +516,6 @@
         if dominfo['domainname'].startswith('xn--'):
             dominfo['domainname'] += ' (%s)'\
                 % VirtualMailManager.ace2idna(dominfo['domainname'])
-        if dominfo['aliases'] is None:
-            dominfo['aliases'] = 0
         if details is None:
             return dominfo
         elif details == 'accounts':
@@ -642,11 +640,19 @@
         alias = self.__getAlias(aliasaddress, targetaddress)
         alias.delete()
 
-    def userInfo(self, emailaddress, diskusage=False):
+    def userInfo(self, emailaddress, details=None):
+        if details not in [None, 'du', 'aliases', 'full']:
+            raise VMMException(_(u'Invalid argument: »%s«') % details,
+                    ERR.INVALID_AGUMENT)
         acc = self.__getAccount(emailaddress)
         info = acc.getInfo()
-        if self.__Cfg.getboolean('maildir', 'diskusage') or diskusage:
+        if self.__Cfg.getboolean('maildir', 'diskusage')\
+        or details in ['du', 'full']:
             info['disk usage'] = self.__getDiskUsage('%(maildir)s' % info)
+            if details in [None, 'du']:
+                return info
+        if details in ['aliases', 'full']:
+            return (info, acc.getAliases())
         return info
 
     def userByID(self, uid):