VirtualMailManager/catchall.py
branchv0.6.x
changeset 507 2aae58cddfa9
parent 504 f180ead60568
child 509 1a9247e9763f
equal deleted inserted replaced
506:fb0ffde628d6 507:2aae58cddfa9
    37     __slots__ = ('_domain', '_dests', '_gid', '_dbh')
    37     __slots__ = ('_domain', '_dests', '_gid', '_dbh')
    38 
    38 
    39     def __init__(self, dbh, domain):
    39     def __init__(self, dbh, domain):
    40         self._domain = domain
    40         self._domain = domain
    41         self._dbh = dbh
    41         self._dbh = dbh
    42         self._gid = get_gid(self._dbh, self._addr.domain)
    42         self._gid = get_gid(self._dbh, self.domain)
    43         if not self._gid:
    43         if not self._gid:
    44             raise AErr(_(u"The domain '%s' does not exist.") %
    44             raise AErr(_(u"The domain '%s' does not exist.") %
    45                        self._addr.domainname, NO_SUCH_DOMAIN)
    45                        self._addr.domainname, NO_SUCH_DOMAIN)
    46         self._dests = []
    46         self._dests = []
    47 
    47 
    49 
    49 
    50     def _load_dests(self):
    50     def _load_dests(self):
    51         """Loads all known destination addresses into the _dests list."""
    51         """Loads all known destination addresses into the _dests list."""
    52         dbc = self._dbh.cursor()
    52         dbc = self._dbh.cursor()
    53         dbc.execute('SELECT destination FROM catchall WHERE gid = %s',
    53         dbc.execute('SELECT destination FROM catchall WHERE gid = %s',
    54                     self._gid)
    54                     (self._gid,))
    55         dests = dbc.fetchall()
    55         dests = dbc.fetchall()
    56         if dbc.rowcount > 0:
    56         if dbc.rowcount > 0:
    57             self._dests.extend(DestAddr(dest[0], self._dbh) for dest in dests)
    57             self._dests.extend(DestAddr(dest[0], self._dbh) for dest in dests)
    58         dbc.close()
    58         dbc.close()
    59 
    59