# HG changeset patch # User martin f. krafft # Date 1334009292 -7200 # Node ID 1fa354bbdb902c17ddafda9eafc4ad951d741f6b # Parent 1a9247e9763fedc782d0dcad0228335a81563727 Add catchall info to domain_info output diff -r 1a9247e9763f -r 1fa354bbdb90 VirtualMailManager/cli/subcommands.py --- a/VirtualMailManager/cli/subcommands.py Tue Apr 10 00:07:49 2012 +0200 +++ b/VirtualMailManager/cli/subcommands.py Tue Apr 10 00:08:12 2012 +0200 @@ -274,7 +274,7 @@ else: details = ctx.args[3].lower() if details not in ('accounts', 'aliasdomains', 'aliases', 'full', - 'relocated'): + 'relocated', 'catchall'): usage(INVALID_ARGUMENT, _(u"Invalid argument: '%s'") % details, ctx.scmd) try: @@ -308,11 +308,14 @@ _print_list(info[1], _(u'aliases')) elif details == u'relocated': _print_list(info[1], _(u'relocated users')) + elif details == u'catchall': + _print_list(info[1], _(u'catch-all destinations')) else: _print_list(info[1], _(u'alias domains')) _print_list(info[2], _(u'accounts')) _print_list(info[3], _(u'aliases')) _print_list(info[4], _(u'relocated users')) + _print_list(info[5], _(u'catch-all destinations')) def domain_quota(ctx): diff -r 1a9247e9763f -r 1fa354bbdb90 VirtualMailManager/domain.py --- a/VirtualMailManager/domain.py Tue Apr 10 00:07:49 2012 +0200 +++ b/VirtualMailManager/domain.py Tue Apr 10 00:08:12 2012 +0200 @@ -414,6 +414,16 @@ relocated = [addr((address[0], _dom)) for address in addresses] return relocated + def get_catchall(self): + """Returns a list with all catchall e-mail addresses of the domain.""" + self._chk_state() + dbc = self._dbh.cursor() + dbc.execute('SELECT DISTINCT destination FROM catchall WHERE gid = %s ORDER ' + 'BY destination', (self._gid,)) + addresses = dbc.fetchall() + dbc.close() + return addresses + def get_aliase_names(self): """Returns a list with all alias domain names of the domain.""" self._chk_state() diff -r 1a9247e9763f -r 1fa354bbdb90 VirtualMailManager/handler.py --- a/VirtualMailManager/handler.py Tue Apr 10 00:07:49 2012 +0200 +++ b/VirtualMailManager/handler.py Tue Apr 10 00:08:12 2012 +0200 @@ -515,7 +515,7 @@ Domain.get_aliase_names(), Domain.get_aliases() and Domain.get_relocated.""" if details not in [None, 'accounts', 'aliasdomains', 'aliases', 'full', - 'relocated']: + 'relocated', 'catchall']: raise VMMError(_(u"Invalid argument: '%s'") % details, INVALID_ARGUMENT) dom = self._get_domain(domainname) @@ -533,9 +533,11 @@ return (dominfo, dom.get_aliases()) elif details == 'relocated': return(dominfo, dom.get_relocated()) + elif details == 'catchall': + return(dominfo, dom.get_catchall()) else: return (dominfo, dom.get_aliase_names(), dom.get_accounts(), - dom.get_aliases(), dom.get_relocated()) + dom.get_aliases(), dom.get_relocated(), dom.get_catchall()) def aliasdomain_add(self, aliasname, domainname): """Adds an alias domain to the domain.