VirtualMailManager/alias.py
branchv0.6.x
changeset 424 46c296c6e231
parent 417 8209da83e256
child 425 8394e222aba3
equal deleted inserted replaced
423:a43a2e20de71 424:46c296c6e231
     7 
     7 
     8     Virtual Mail Manager's Alias class to manage e-mail aliases.
     8     Virtual Mail Manager's Alias class to manage e-mail aliases.
     9 """
     9 """
    10 
    10 
    11 from VirtualMailManager.domain import get_gid
    11 from VirtualMailManager.domain import get_gid
    12 from VirtualMailManager.emailaddress import EmailAddress
    12 from VirtualMailManager.emailaddress import \
       
    13      EmailAddress, DestinationEmailAddress as DestAddr
    13 from VirtualMailManager.errors import AliasError as AErr
    14 from VirtualMailManager.errors import AliasError as AErr
    14 from VirtualMailManager.ext.postconf import Postconf
    15 from VirtualMailManager.ext.postconf import Postconf
    15 from VirtualMailManager.pycompat import all
    16 from VirtualMailManager.pycompat import all
    16 from VirtualMailManager.constants import \
    17 from VirtualMailManager.constants import \
    17      ALIAS_EXCEEDS_EXPANSION_LIMIT, NO_SUCH_ALIAS, NO_SUCH_DOMAIN
    18      ALIAS_EXCEEDS_EXPANSION_LIMIT, NO_SUCH_ALIAS, NO_SUCH_DOMAIN
    42         dbc = self._dbh.cursor()
    43         dbc = self._dbh.cursor()
    43         dbc.execute('SELECT destination FROM alias WHERE gid = %s AND '
    44         dbc.execute('SELECT destination FROM alias WHERE gid = %s AND '
    44                     'address = %s', (self._gid, self._addr.localpart))
    45                     'address = %s', (self._gid, self._addr.localpart))
    45         dests = dbc.fetchall()
    46         dests = dbc.fetchall()
    46         if dbc.rowcount > 0:
    47         if dbc.rowcount > 0:
    47             self._dests.extend(EmailAddress(dest[0]) for dest in dests)
    48             self._dests.extend(DestAddr(dest[0], self._dbh) for dest in dests)
    48         dbc.close()
    49         dbc.close()
    49 
    50 
    50     def _check_expansion(self, count_new):
    51     def _check_expansion(self, count_new):
    51         """Checks the current expansion limit of the alias."""
    52         """Checks the current expansion limit of the alias."""
    52         postconf = Postconf(cfg_dget('bin.postconf'))
    53         postconf = Postconf(cfg_dget('bin.postconf'))